Answers

Question and Answer:

  Home  Linux Device Drivers

⟩ In this program the two printed memory locations has the difference of ___ bytes. #include<stdio.h> #include<stdlib.h> int main() { int *ptr; ptr = (int*)malloc(sizeof(int)*2); printf("%pn",ptr); printf("%pn",ptr+1); return 0; } a) 1 b) 4 c) can not be determined d) none of the mentioned

b) 4

Explanation:

Pointer will increment by 4 bytes because it is the types of integer.

Output:

[root@localhost google]# gcc -o san san.c

[root@localhost google]# ./san

0x9b4e008

0x9b4e00c

[root@localhost google]#

 182 views

More Questions for you: