Tuesday 10 June 2014

Input\output operations in C

Input\output operations in c


Input è scanf() function
Output è printf() function


printf(): write in  “ “ what you want to display on console screen.
                Example: 1) printf(“Hello world”);
                                Output: Hello world
                Example: 2) when you want to print decimal value
                                int a=88;
                                printf(“result = %d”,a);
                                output: result = 88;

note: here   d   is specifier which is replaced by the value of   variable  a  outside the “ “ separated by the comma (,).
Type
Quality input
C
For single character
D
For decimal values
F
Floating point numbers
E, e
Floating point numbers in form of exponential format
G
Floating point number in the shorter of e format
O
For octal numbers
S
For a sequence of character (string)
U
Unsigned decimal values
X, X
Hexadecimal values












scanf() è same rules are applied for the input function scanf() as printf(); But the main difference is the “&” operator.
Example:   int rno;
                scanf(“%d”, &rno);

*) Here we have to write &rno instead of   rno .
*) The sign “ & “  means ‘address of’ .
Every variable has an address in the computer memory where we have to store the value  for that variable. So we use “ & “ sign.


No comments:

Post a Comment