edited by
744 views
7 votes
7 votes

What is the output of the following program?

#include<stdio.h>

int main()

{

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

printf(“%d”, -2[array]);

return 0;

}
  1. $-60$
  2. $-30$
  3. $60$
  4. Garbage value
edited by

3 Answers

Best answer
3 votes
3 votes
arr[i] is equal to i[arr] is also equal to *(arr+i)

so answer should be -30
selected by

Related questions

3 votes
3 votes
1 answer
1
Parshu gate asked Nov 13, 2017
1,380 views
main( ){int n[3][3] = {2, 4, 3,6, 8, 5,3, 5, 1} ;printf ( "\n%d %d %d", *n, n[3][3], n ) ;}
1 votes
1 votes
1 answer
2
1 votes
1 votes
0 answers
3
Ashish Roy 1 asked Mar 16, 2019
1,625 views
In the above 4 Statements which would print 123 as output ? Explain also.
1 votes
1 votes
0 answers
4
Akshay Nair asked Jan 29, 2018
428 views
What is the output of the following program?void main(){printf("%d",5%2);printf("%d",-5%2);printf("%d",5%-2);printf("%d",-5%-2);printf("%d",2%5);}A) 1,-1 -1 1 0B)1 -1 1 -...