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
What is a c token and types of c tokens?
how can f be used for both float and double arguments in printf? Are not they different types?
what value is returned to operating system after program execution?
what is bit rate & baud rate? plz give wave forms
What are the difference between a free-standing and a hosted environment?
Explain output of printf("Hello World"-'A'+'B'); ?
Can we compile a program without main() function?
Does c have enums?
What is use of #include in c?
What is multidimensional arrays
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
Are negative numbers true in c?
Combinations of fibanocci prime series
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
How can I find out if there are characters available for reading?