I am learning OS course.
We were taught pipes and this program is not getting compiled in GCC 4.4.7. When we change main
to int main
, it compiles fine. What is the reason?
Command line: gcc pipedemo.c
#include<stdio.h>
#include<sys/types.h>
#include<string.h>
#include<unistd.h>
#include<stdlib.h>
#define BUFFER_SIZE 100
#define READ_END 0
#define WRITE_END 1
main()
{
char source[]="pipe_program";
char dest[BUFFER_SIZE];
char datas[BUFFER_SIZE];
char datar[BUFFER_SIZE];
int fd1[2],fd2[2];
pid_t pid;
if(pipe(fd1)==-1)
{
fprintf(stderr,"Pipe creation failed\n");
exit(0);
}
if(pipe(fd2)==-1)
{
//...
}
//...
}