I have used this syntax for printing some variable n. I know that the syntax is wrong but was not able to understand what is happening behind the scenes. It is not even creating an error. Inside the main method:
int fac,p=1,n,i;
printf("Enter the value of n \n");
scanf("%d",&n);
printf("The factorial is \n %d"+n);
I have used +n
in last line and that is not the right syntax.
Input is 1 Output is:
he factorial is
1
Input is 5 Output is:
actorial is
1
Can someone help me to figure out what is happening behind the scenes? How is that the compiler understanding that +n
in print function? From where the 1 is coming in the output?