Getting the error as the title says. No idea how to get this code running. I cant seem to find the error.
[Error] ld returned 1 exit status
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h> //NOTE: Added
int a[5] = {0,1,2,3,4};
int main()
{
int b[5] = {5,6,7,8,9};
pid_t pid;
pid = fork();
int i;
if(pid == 0){
for(i = 0; i<5;i++)
a[i]*=2;
for(i = 0; i<5;i++)
b[i]*=2;
}
else{
wait(NULL);
for(i =0;i<5;i++)
printf('%d', a[i]);
for(i =0;i<5;i++)
printf('%d', b[i]);
}
return 0;
}
If you need any additional information or help just please commennt and i will fill in with whatever you need
before the error message described above these two messages appear:
test.c:(.text+0x31): undefined reference to `fork'
test.c:(.text+0xb6): undefined reference to `wait'