What will be the output and why?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What will be the output and why??

#include <stdio.h> void main() { int x = 4; int *p = &x; int *k = p++; int r = p - k; printf("%d", r); }

29th Jul 2019, 5:13 AM
GameHuB
GameHuB - avatar
1 Answer
0
The answer will be 1 because of the difference between two pointers gives us the distance between the two(in simple words) in terms of value not bytes.
29th Jul 2019, 5:34 AM
parag sahu
parag sahu - avatar