Interviewer And Interviewee Guide

Device Drivers Interview Question:

Which one of the following in true about this program?

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main()
{
char *ptr;
printf("%pn",ptr);
ptr = (char *)malloc(sizeof(char));
printf("%pn",ptr);
return 0;
}
a) this program will give segmentation fault
b) this program will print two same values
c) this program has some syntax error
d) none of the mentioned

Submitted by: Murtaza
d) none of the mentioned
Explanation:
This program will print two different values.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
0x4a77cff4
0x980c008
[root@localhost google]#
Submitted by: Murtaza

Read Online Device Drivers Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.