What Is C :-
It is structured programming language that means we can perform any operation on to group of values & we can use in group.
It is case sensitive language that means it is differentiate between capital & small letter.
Input / Output Function :-
To perform any input / output operation , we use a header file such as # include <stdio.h> here.
# is preprocessor which collect all information related to current program at compile time.
Include means include the header file or any other user defined file in current program. These file must be exist at include folder.
<stdio.h> stands for standard input / output header file. It contains some existing input /output functions. It includes following functions.
printf():- It is used to print the message on output screen, it print message in same line either we use same or different printf() function. Message specify within double quotation mark. Message can be write in capital or small letter.
Example – printf(“Easy”) ;
printf(“Notes”);
Output EasyNotes2012
To print message in different line we use \n , this is write within quotation mark & after that text or value write in next line.
Example :- printf(“Easy\n ”);
printf (“Notes”);
Output
Easy
Notes
\n specified within quotation mark still it has special meaning hence it is also called tri- character/ escape sequence. Other tri-characters are
\n – new line
\t – tab space
\b – back space
\r – home
\a – red alert
\t tab space :- It left 8 character space & it count from the first character. If we print seven character then left only 1 space.
Example – printf(“Easy\t soft”);
Easy_ Soft
printf(“Eas\t Soft”);
Vin_____ Soft
\b back space :- It is used to delete single character or overwrite single character.
Example – printf(“Easy\b Notes”);
Easy Notes
\r home :- It is used to move the cursor at first column in same live & after that already write character overwrite it
Example :- printf(“EasyNotes \r notes”);
Easynotes
notesnotes
Question:- Write a C program to print your name ?
Answer - # include <stdio.h>
# include <conio.h>
main()
{
clrscr();
printf(“Hello\n”);
printf(“My First Prog”);
printf(“\n in c”);
getch();
}
Line 1 shows include the standard input / output file & it is used for printf() function.
Line 2 shows include the console input / output header file & it include for clrscr() & getch() function.
Line 3 shows main function write in small letter & it is the starting position, which execute our program.
Line 4 shows the starting body.
Line 5 use to remove all text from output screen.
Line 6,7,8 is used to print the message on output screen.
Line 9 is used to pause the screen.
Line 10 shows the close of body.
1 byte = 8 bit
Data type in C :-
It means what value we want to store & what operation we want to perform called data type. In ‘C’ 6 types of data type are available.
1. int:- It allows 0 to 9 digit (+), (-) sign but does not allow any decimal point value. It takes 2 byte space in memory. Its range is –32768 to 32767. It also called signed int or short int.
Example :- int a ; +-5 (2 byte)
Or signed int a;
Or short int a;
a=5.5 X
It can be declared as unsigned, which store only positive value. It’s range is 0 to 65535.
2. long :- It is like integer but it store large value than int. It’s memory space is A byte. It’s range is –231 to 231–1 byte.
3. float :- It is like other data type to store numeric value but it store all real value that means we can store 0 to 9 digit (+),(-) sign & also decimal point value.
float f = 3.5
It’s memory space is 4 byte & its range is 1038 .
Floating Point Representation :-
Example:- 387.2 = 3.872 x 102
+02
Mantissa exponent
0.000382 = 3.82 x 10-4
-04
Mantissa exponent
4. Double :- It is like float but its memory space is 8 byte & its range is 10308
5. Long Double :- It is like float but its memory space is 10 byte & its range is 10380
6. Character :- It allows whole key board that means we can store 0 to 9 digit (+),(-) sign, alphabet special character but at a time, we can store only single character.
Click To Download
Viwe To Full E.book