L Lâm Phung New member Sep 19, 2021 #1 What is the output of this program? Code: #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char *ptr; ptr = (char*)malloc(sizeof(char)*11); strcpy(ptr,"123hoidap"); printf("%d\n",*ptr); return 0; } A. s B. 123hoidap C. 115 D. segmentation fault
What is the output of this program? Code: #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char *ptr; ptr = (char*)malloc(sizeof(char)*11); strcpy(ptr,"123hoidap"); printf("%d\n",*ptr); return 0; } A. s B. 123hoidap C. 115 D. segmentation fault
N Nhật Hương Member Sep 19, 2021 #2 Answer: c Explanation: This program will print the equivalent decimal value at location pointed by “ptr”. Output: [root@localhost 123hoidap]# gcc -o san san.c [root@localhost 123hoidap]# ./san 115 [root@localhost 123hoidap]# Upvote 0 Downvote
Answer: c Explanation: This program will print the equivalent decimal value at location pointed by “ptr”. Output: [root@localhost 123hoidap]# gcc -o san san.c [root@localhost 123hoidap]# ./san 115 [root@localhost 123hoidap]#