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 the auto keyword good for?
Why do we use c for the speed of light?
State two uses of pointers in C?
What is #line used for?
How do you list a file’s date and time?
What is a pointer value and address in c?
What are formal parameters?
How can you check to see whether a symbol is defined?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
Dont ansi function prototypes render lint obsolete?
Why does everyone say not to use scanf? What should I use instead?
What is infinite loop?
Explain the priority queues?
write a program in c language to print your bio-data on the screen by using functions.
What is difference between far and near pointers?