Assume n = 10; what will be result of n++ and --n;?
Advertisements
प्रश्न
Assume n = 10; what will be result of n++ and --n;?
Advertisements
उत्तर
11 and 9 respectively.
the notations like n++ and ++n are used in coding
both n++ and ++n stand for n=n+1 but there is small difference.
if we assume a=10 and n=10 then a<++n is true but a<n++ is false.
for a<++n first n value gets increment by 1 and becomes 11 then the condition is checked.
for a<n++ first the condition is checked and becomes false then n is incremented by 1 and becomes 11.
- -n and n- - also explained in the same way but - - is decrement operator w3here as ++ is increment operator.
APPEARS IN
संबंधित प्रश्न
Can keywords be used as identifiers?
The following constant is of which type?
39
Write the following real constant into the exponent form:
7.214
Write the following real constant into the exponent form:
0.319
Describe the differences between keywords and identifiers?
Is C++ case sensitive? What is meant by the term “case sensitive”?
Consider the following C++ statement. Are they equivalent?
char ch = 67;
char ch = ‘C’;
Determine which of the following are valid constant? And specify their type.
‘Name’
Determine which of the following are valid constant? And specify their type.
27,822
How relational operators and logical operators are related to one another?
