Saturday, March 12, 2011

what scanf returns?????

scanf() returns the number of variables that were successfully assigned values means the number of successful inputs.

lets try to understand more clearly with the help of an example:

void main()
{
int i,j,k;
printf("Enter the values:");
i=scanf("%d%d",&j,&k);
printf("value of i=%d",i);
}

output:
Enter the values:12 13
value of i=2

No comments:

Post a Comment

Feel free to comment......