What will be the output and why?? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponse
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