what will be the output of this program?
void main()
{
int a[]={5,10,15};
int i=0,num;
num=a[++i] + ++i +(++i);
printf("%d",num);
}
Answer Posted / ricky
Garbage Value
num=a[++i] + ++i +(++i);
in this line the last i will be incremented first
so the last ++i will return 1 after that the middle ++i will return 2 now the value of i will change every where in the program now the first ++i will return 3 since the array starts with a[0] and ends at a[2] there is no a[3] and hence it will print garbage value
| Is This Answer Correct ? | 5 Yes | 3 No |
Post New Answer View All Answers
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
Where are local variables stored in c?
a program that can input number of records and can view it again the record
What does a function declared as pascal do differently?
Tell us two differences between new () and malloc ()?
Can you please explain the difference between exit() and _exit() function?
What is static function in c?
What is getch c?
In C language what is a 'dangling pointer'?
I have a varargs function which accepts a float parameter?
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
What is difference between union All statement and Union?
What is scanf () in c?
What is the total generic pointer type?
Explain enumerated types in c language?