Are the next two code blocks exactly the same and achieve the same? It displays the same when I run the program, but I would appreciate some strict explanations.
for(i=1;i<=10;i++)
{
printf("%d\n",i);
}
and
for(i=1;i<=10;printf("%d\n",i),i++);
The loop forexpects valid C statements as arguments, right? But even if I checked in StackOverflow that expressions such as x+=4,y=x*2;are safe, since the comma acts like sequence points here, is the same true for the statement printf("%d\n",i),i++)passed as an argument in the loop forabove?
And if so, please take the trouble to answer the secondary question that arises from it:
comma
:
printf("Enter number\n"),scanf("%d",&number),printf("You entered %d",number);