Device Drivers Question:
What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *ptr;
ptr = (char*)malloc(sizeof(char)*11);
strcpy(ptr,"google");
printf("%dn",*ptr);
return 0;
}
a) s
b) google
c) 115
d) segmentation fault
Answers:
Answer #1c) 115
Explanation:
This program will print the equivalent decimal value at location pointed by "ptr".
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
115
[root@localhost google]#
Explanation:
This program will print the equivalent decimal value at location pointed by "ptr".
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
115
[root@localhost google]#
Answer #2103 asci for 'g'