847 views
–2 –2 votes

1 Answer

1 1 vote
Fun (a++,a++,a++); is compiler dependent we are doing incement of a more than 1 time in same line so is right most a++ done 1st then answer is different , if leftmost a++ done 1st then answer is different . So answer varry from compiler to compiler . This probelm is known as sequence points
Position:
Show:

Related questions

7 7 votes
2 2 answers
312
312 views
GO Classes asked Jun 29
312 views
What is the output of the following code?#include <stdio.h struct Item { int code; int price; }; void update(struct Item *p) { p->price = p->price + 20; (*p).code = (*p)....
7 7 votes
3 3 answers
326
326 views
GO Classes asked Jun 25
326 views
What is the output of the following code?#include <stdio.h void update(int q, int *r) { q = q + 5; *q = r; q = q + 2; } int main() { int x = 3, y = 8; int *p = &x; u...
9 9 votes
2 2 answers
269
269 views
GO Classes asked Jun 24
269 views
What is the output of the following code?#include <stdio.h void fun(int *p) { *p = *p + 1; p++; *p = *p + 2; } int main() { int arr[] = {5, 10, 15}; fun(arr + 1); printf(...
9 9 votes
2 2 answers
266
266 views
GO Classes asked Jun 24
266 views
What is the output of the following code?#include <stdio.h void update(int a[]) { a[0] = a[0] + a ; *(a + 1) = *(a + 1) + 5; } int main() { int arr[] = {2, 4, 6}; update(...