Linux Search Pattern Question: Download Search Pattern PDF

Do you know what is the output of this program?

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

int main()
{
int fd;
char *buff;
buff = (char *)malloc(sizeof(char)*5);
fd = open("google.txt",O_RDWR|O_CREAT);
write(fd,"Linux",5);
read(fd,buff,5);
printf("%sn",buff);
}
a) it will print nothing
b) it will print the string "Linux"
c) segmentation fault
d) none of the mentioned

Tweet Share WhatsApp