Answers

Question and Answer:

  Home  Linux Device Drivers

⟩ Do you know what is the output of this program? #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char *ptr; memcpy(ptr,"google",11); printf("%sn",ptr); return 0; } a) google b) segmentation fault c) syntax error d) none of the mentioned

b) segmentation fault

Explanation:

Memory must be allocated to pointer "ptr".

Output:

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

[root@localhost google]# ./san

Segmentation fault (core dumped)

[root@localhost google]#

 180 views

More Questions for you: