scanf function
What scanf function do?
void main()
{
int a,b;
printf("%d,%d,%d",scanf("%d %d",&a,&b));
}
run this program in Turbo C compiler ...
Input:
12 23
Output :
2 23 12
Result Analysis :
scanf function accept number(s) from the keyboard and store them into a stack. From left to right the accepted values will be stored into stack. scanf will also store the total number of format string used in the scanf (i.e 2). due to stack the top most value will be 2 next value will be 23 and the value at the bottom will be 12.
| 2 |
----
|23|
----
|12|
----
stack will look like above figure.
Result Analysis :
scanf function accept number(s) from the keyboard and store them into a stack. From left to right the accepted values will be stored into stack. scanf will also store the total number of format string used in the scanf (i.e 2). due to stack the top most value will be 2 next value will be 23 and the value at the bottom will be 12.
| 2 |
----
|23|
----
|12|
----
stack will look like above figure.
Comments
Post a Comment