#include <stdio.h>
void printPattern ( int n );
int main(){
int n =3;
printPattern(n);
return 0;
}
// for n = 3
// *
// ***
// *****
// 1-1
// 2-3
// 3-5
void printPattern ( int n ){
if (n ==1 ){
printf("*\n");
return;
}
printPattern(n-1);
for (int i = 0;i<(2*n-1);i++){
printf("*");
}
printf("\n");
}
please explain to me this C language code I copied from a youtube tutorial it prints like this
*
***
*****
but how ?? I can't understand this recursion and please don't share another method to do this because I am trying to learn recursion in C but these types of projects shake my head!