- The C character Set
- Small letters (a....z)
- Capital latter (A,B.....Z)
- Digit (0....9)
- Special Characters (+,-,*,/,%,!,#,&,<,> etc)
- White space like new line,blank space etc.
- Identifiers
- Keyword
do | goto | signed | while |
auto | double | if | static |
char | extern | near | typedef |
break | else | int | struct |
case | enum | long | switch |
const | float | register | union |
continue | far | return | unsigned |
default | for | short | void |
- PreprocessorProgrammer specify name of header file in this section. It provide instruction to C compiler.
Header files such as: #include <conio.h> , #include<stdio.h> , #include<math.h> etc. - Function HeadingThis section contain function name with arguments (if any) such as main().
- Variable DeclarationThis section contain variable declaration , definition , initialisation with their data type. Such as int x=1; , cahr a; , float p=3.14; etc. This section end with semi colon.
- Compound StatementThis section contain group of statement. Statements contain printf , scanf , if..else , switch case , getch() , calculation (a=b+c) etc statements in this section. We can say that this section contain Input , Output , calculation part , condition statements.
- for loop
- while loop
- do-while loop
In C following loop structure are available:
test expression;
update expression;)
body-of-the-loop;
for(i=1;i<=10;i++)
printf("\n%d",i);
getch();
test expression 1 test expression 2;
update expression 1 update expression 2)
for( ; ;)--infinite
Function play an important role in programming.It is basically a collection of statements which perform specific task.Each function have some specific name which is used for calling the purpose in any program.We can say that it is a type of sub-program.
Function is a self contain program that can perform some specific and well define task. A large program is broken down into number of smaller program in the form of function which can perform specific task. we can achieve re-usability by creating functions.Any function can define once and call many times in a program.
In C programming their are two type of functions such as:
✔ Predefined functions
✔ User define functions.
BUILT-IN FUNCTION
PREDEFINED FUNCTION
Predefined functions are built-in functions or library functions which is used by user.User can not define those functions.These functions are created at the time of creation of C language.We cannot change their definition.These functions are stored in library files and these library files are known as header files. We can identify these file by ( .h ) extension.There are so many header files are present in C.If we want to use any built-in function in our program than we must include these header files in C program by using INCLUDE keyword.
like: # include <conio.h> , # include <stdio.h> , # include <math.h> , # include <string.h> etc.
Now we can simply say that all built-in function are available in header files. So without including these header file we can not use any built-in functions in any program.
Some built-in functions are printf() , scanf() , sum() , pow() etc
USER DEFINE FUNCTION:
User define function are those function which is define by user for their specific task.Let we understand Why user define function needed ?
We know that we write our program inside main() function. If our program is small than no need to create any functions but if our program goes long in size line of code than we must break our program in small modules called function.
No comments:
Post a Comment