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
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
What is pass by reference in functions?
What are structural members?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
What is difference between scanf and gets?
Why void is used in c?
Is stack a keyword in c?
How do you use a pointer to a function?
How do you override a defined macro?
What is the translation phases used in c language?
What is volatile variable in c with example?
What is data structure in c language?
What is the meaning of 2d in c?
Disadvantages of C language.
What are global variables?