Interviewer And Interviewee Guide

Device Drivers Interview Question:

What is the output of this program?

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

int main()
{
int ptr;
ptr = (int)malloc(sizeof(int)*10);
return 0;
}
a) syntax error
b) segmentaion fault
c) run time error
d) none of the mentioned

Submitted by: Murtaza
d) none of the mentioned
Explanation:
The memory has been allocated but we can not access rest of the memory other than 4 bytes.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
[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.