edited by
1,700 views
2 votes
2 votes

#include <stdio.h>

int arr[] = { 10, 20, 30, 40, 50 };

static int count ;

inc() {

return ++count;

}

int main()

{

arr[count++]=inc();

printf("%d ", arr[count]);

printf("%d ", arr[0]);

}

https://ideone.com/5LOuqj 

 

edited by

3 Answers

0 votes
0 votes

the answer is 30,2 here

 

0 votes
0 votes
undefined behaviour  Sequence Point Problem.

arr[count++]=inc();

arr[count++]=++count;

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
0 answers
2
utkarshkosta asked Dec 22, 2018
364 views
#include<stdio.h int main() { char A[5][7][6]; char *p[5][7][6]; printf(“%d\t”,(unsigned)(A+1)-(unsigned)A); printf(“%d”,(unsigned)(p+1)-(unsigned)p); } OPTIONS:4...
1 votes
1 votes
2 answers
3
rahul sharma 5 asked Dec 14, 2016
452 views
For n=2 the P is coming as 3,but none of the option is satisfying?