I am getting (2^n)+1 '*' only..
for eg for n 2
expanding the for loop (loop unrolling) it can be written as
(1) process (parent)-->
printf("*" );
fork();-----> creates new process (2) with code-----> fork(); printf("*")----->creates another (3)---->printf("*)
fork()------------> creates process (4) ----->printf("*);
printf("*);
So total * printed are 5 for n=2
In general for n for loops 2^n -1 child process would be created so 2^n-1 time * would be printed by child process + 2 times by parent ...in total 2^n+1 '*' would be printed.