Ask coding questions

← Back to all posts
i need to solve this question tree of processes(each process have to print its id and its parent id)
mohamadkassem (1)

p1 given p2 and p3 and p4,p2 given p5 (this is model to solve the question
can we help me to solve in c programming

Answered by mwilki7 (1132) [earned 5 cycles]
View Answer
Comments
hotnewtop
mwilki7 (1132)

printf needs format specifiers to work

printf( "%d\n", getpid() ); // 1 %d means 1 extra argument
printf( "%d %d\n", getpid(), getpid() ); // 2 %d's means 2 extra arguments

%d is int
http://www.cplusplus.com/reference/cstdio/printf/