Why printf() don’t gives any error and issue with scanf()

Code-

int main(int argc,char **argv)
{
  int y,i;
  printf("Number of character you entered is : %d",printf("you entered age : %dn",i,scanf("%d",&i),printf("Enter age : "))-19);
  printf("nn");
  scanf("%d ",&y,printf("Enter number(y) : "));
  printf("Value of y is %d",y);
}

Here are two statements ,
In first statement i want to ask why printf() don’t give any error or warning?

printf("Number of character you entered is : %d",printf("you entered age : %dn",i,scanf("%d",&i),printf("Enter age : "))-19);

Second statement when executing is asking for input two times .. first time after “Enter number(y) : ”
after entering number it ask for another input , don’t know why ?
And value of y is the value you entered first time so what’s the matter behind second input ?

scanf("%d ",&y,printf("Enter number(y) : "));


Source: c#

Leave a Reply