0

What will be output?

int *p,*q; p=(int *)1000; q=(int *)2000; printf("%d",(q-p));

7th Mar 2019, 3:53 AM
Sunny Sharma
Sunny Sharma - avatar
4 Respostas
+ 3
You're using int pointers to point to arbitrary memory locations 1000 and 2000. Their difference is 1000, which means that there is room for 250 integers between those two locations. That's the output. You're not calculating with integers but using pointer arithmetic. That's a good way to make your program crash (or worse) if you don't know what you're doing
7th Mar 2019, 6:41 AM
Anna
Anna - avatar
+ 1
250 and what Jay said.
7th Mar 2019, 5:26 AM
Diego
Diego - avatar
0
I tried
7th Mar 2019, 4:09 AM
Sunny Sharma
Sunny Sharma - avatar
0
Give me output pls
7th Mar 2019, 4:17 AM
Sunny Sharma
Sunny Sharma - avatar