+ 2
what is the output of this code and how??
int arr[3]={40,41,42}; int *ptr=(int*)(&arr+1); printf("%d %d", *(arr+1) , *(ptr-1));
11 Answers
+ 2
Error cause you try to print a number but a pointer is supplied.
+ 1
Cause of the ampersand '&' here is expected output:
https://code.sololearn.com/c1qq2eHR9ZP4/?ref=app
+ 1
Martin Taylor the code he supplied outputs 41 42. When i removed the ampersand it gave expected output. I think he wants to know why
0
Slick you are right and i ve edited this code, now what is the output
0
Tell me what the output is please
0
41 42 Slick
0
could you tell me how one find the *(ptr-1) as 42. Slick
thanks
0
https://gateoverflow.in/275251/Geeksforgeeks
this post also was helpful.
- 1
VriddhiJain