Question: Please help me figure out why im getting this error, warning: passing argument 1 of atoi from incompatible pointer type [ - Wincompatible - pointer
Please help me figure out why im getting this error, "warning: passing argument of atoi from incompatible pointer type Wincompatiblepointertypes
int num atoiargstr; and help me make sure my code will print what it is supposed to in the first picture
Generator.c
#include
#include
#include
#include
#include
int mainint argc, char argv
pidt pid;
FILE fp fopenargvr;
if fp
perrorFile open failed";
exitEXITFAILURE;
sizet listSize ;
sizet lineCount ;
char list malloclistSize sizeofchar ;
char line;
Reading lines from the file
while fgetsline sizeofline fp
listlineCount mallocstrlenline;
strcpylistlineCount line;
lineCount;
Resize list if needed
if lineCount listSize
listSize ;
list realloclist listSize sizeofchar ;
fclosefp;
for int i ; i lineCount; i
printfGenerator Process: Processing line s
listi;
Forking a child process
pid fork;
char program;
char argstr listi;
if pid
perrorFork failed";
exitEXITFAILURE;
else if pid
In the child process
program Fibonacci;
execlpprogram program, argstrchar NULL;
perrorexeclp failed"; This line is only reached if execlp fails
exitEXITFAILURE;
else
In the parent process
int status;
wait&status; Wait for the child to finish
if WIFEXITEDstatus
int result WEXITSTATUSstatus;
program Fibonacci;
printfs Process finished PID: d Returned: d
program, pid, result;
pid fork;
if pid
perrorFork failed";
exitEXITFAILURE;
else if pid
program Perrin;
execlpprogram program, resultchar NULL;
perrorexeclp failed"; This line is only reached if execlp fails
exitEXITFAILURE;
else
In the parent process
int status;
wait&status; Wait for the child to finish
if WIFEXITEDstatus
int result WEXITSTATUSstatus;
printfs Process finished PID: d Returned: d
program, pid, result;
pid fork;
if pid
perrorFork failed";
exitEXITFAILURE;
else if pid
In the child process
program Composite;
Replace current process with new program
execlpprogram program, resultchar NULL;
perrorexeclp failed"; This line is only reached if execlp fails
exitEXITFAILURE;
else
In the parent process
int status;
wait&status; Wait for the child to finish
if WIFEXITEDstatus
int result WEXITSTATUSstatus;
printfs Process finished PID: d Returned: d
program, pid, result;
else
printfChild process did not terminate normally.
;
else
printfChild process did not terminate normally.
;
else
printfChild process did not terminate normally.
;
Free memory
for int i ; i lineCount; i
freelisti;
freelist;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
