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
How to write a multi-statement macro?
Can the “if” function be used in comparing strings?
Write a C program in Fibonacci series.
List a few unconditional control statement in c.
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
what are the facialities provided by you after the selection of the student.
What does void main return?
What is logical error?
How can you read a directory in a C program?
How to declare a variable?
What should malloc(0) do?
What is pointer in c?
List some of the static data structures in C?
What is difference between class and structure?
What is the difference between #include