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
Can you write the function prototype, definition and mention the other requirements.
What is the most efficient way to count the number of bits which are set in an integer?
simple program of graphics and their output display
write a program to concatenation the string using switch case?
What are the different types of C instructions?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
what are # pragma staments?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
What is meant by preprocessor in c?
What's the best way of making my program efficient?
what do u mean by Direct access files? then can u explain about Direct Access Files?
What is the function of multilevel pointer in c?
Is there a way to jump out of a function or functions?
What are types of functions?
How arrays can be passed to a user defined function