CONVERSION SPECIFICATION CHARACTER
scanf() and printf()
make use of format specifier to specify the the type
and size of data . It must begin with % .
READING INPUT DATA
scanf( " Control String", address 1);
scanf() should have at least two parameters. They are
1. Control string :-
- Control string contains format specifier. It should be written within double quotes. Conversion specification character may be one or more. It depends on number of values we want to input but at least one address should be present.
2. Address :-
- Address of variable is found by preceding the variable by an & sign. & is address of operator which gives starting address of variable name in memory. It should be noted that a sting variable is not preceded by an &.
WRITING OUTPUT DATA
printf( " Control String", variable_name);
Control string contains format specifer or text or both. If the control string does not contain any conversion specification, then variable names are not specified. The name of variable should not be preceded by an & sign.
Eg:- printf(" Number = %d", a); // Here, %d shows, the data type of variable a is integer.
To see the full C program about the above functions Click here.
0 Comments
Post a Comment