Basic C Concepts
Basic C Concepts
21 • 53 5 85 U 117 u
22 • 54 6 86 V 118 v
23 • 55 7 87 W 119 w
24 • 56 8 88 X 120 x
25 • 57 9 89 Y 121 y
26 • 58 : 90 Z 122 z
27 • 59 ; 91 [ 123 {
28 • 60 < 92 \ 124 |
29 • 61 = 93 ] 125 }
30 • 62 > 94 ^ 126 ~
31 • 63 ? 95 _ 127 •
Keywords in C
Detailed list of Data Types in C
Formatting Input/Output
The printf function is used to display information required by the user and also
prints the values of the variables.
Flags:
Flags specify output justification such as decimal point, numerical sign, trailing
zeros, or octal, decimal, or hexadecimal prefixes.
Width:
Width specifies the minimum number of characters to print, that is, the
minimum number of positions in the output.
Precision:
Length:
Length field is used when short int, long int and long double data types used.
Specifier:
Specifier is used to describe the type and interpretation of the value of the
variable in the variable list.
Example:1
Example:2
The scanf() in C
The function scanf() stands for scan formatting and used to read formatted data
from the keyboard.
This function takes a text stream from the keyboard, extract and formats data
from the stream according to a format control string and then stores the data in
the specified variables.
The control string specifies the type and format of the data that has to be
obtained from the keyboard and stored in the memory locations pointed by the
arguments arg1,arg2,arg3,….argn.
The arguments are actually the variable address where each piece of data are to
be stored in memory.
Examples:
Scanf(“%d”,&number1,&number2); // Invalid
Scanf(“%d%d%d”,&number1,&number2);// Invalid
The scanf function can be used to read variables of different types in one single
statement.
Float fnum;
Char ch;
scanf(“%d%f%c”,&num,&fnum,&ch);