About C programming
•Dennis Ritchie was the founder
•Procedural oriented programming language
Examples for procedural oriented programming :- basic, fortran, cobol etc.
• Object Oriented Programming examples : C++, Java, VB etc
Structure of a C program
#include<header file name. h>
Structure of a C program
#include<header file name. h>
User defined function declaration
main()
{
Body of main function;
}
User defined function definition.
•Every program is devided into modules called functions.
•User must define a main function anywhere in the program.
• User can define functions other than main too.
•The execution of a program starts from the main function.
•Other functions must be defined before or after main function.
•Every function body is enclosed within the pair of braces. i.e., {}.
•Comments may appear anywhere in the program, the comments where placed between the
delimiters, /*and*/.
Use of Comments in a Program
•Specify the programs pricipal
•Specify the keyword usage
•Specify modules
We can add single line comments followed by // i.e., //comment
Can add multi-line comments by using
/* comment */ methode.
The C Character set
•Numeric 0-9
•Alphabets a-z
•Alphabets A-Z
•Special characters + - ! @ # $ % ^ & * ( ) / \ ] [ { } ; : ‘ “ ? > < , .
•Combination of these characters such as <= >= && || != \n \b \t \a etc.
Data types in C
int - to represent integer type data
char -to represent character or string type data
float -to represent floating point number
double -to represent double floating point number
void -null value
Data type Qualifiers (Modifiers)
A data type qualifier used to alters the meaning of the base type to more precisely fit a specific
need. We cant apply the modifier on void data type. The modifiers used in C are
•short
•long
•signed
•unsigned
Tokens in C
Tokens are the smallest individual elements, which are identified by the compiler. Tokens in C
can be categorized as :
•Identifiers
•Keywords
•Constants
•Variable
•Operators
main()
{
Body of main function;
}
User defined function definition.
•Every program is devided into modules called functions.
•User must define a main function anywhere in the program.
• User can define functions other than main too.
•The execution of a program starts from the main function.
•Other functions must be defined before or after main function.
•Every function body is enclosed within the pair of braces. i.e., {}.
•Comments may appear anywhere in the program, the comments where placed between the
delimiters, /*and*/.
Use of Comments in a Program
•Specify the programs pricipal
•Specify the keyword usage
•Specify modules
We can add single line comments followed by // i.e., //comment
Can add multi-line comments by using
/* comment */ methode.
The C Character set
•Numeric 0-9
•Alphabets a-z
•Alphabets A-Z
•Special characters + - ! @ # $ % ^ & * ( ) / \ ] [ { } ; : ‘ “ ? > < , .
•Combination of these characters such as <= >= && || != \n \b \t \a etc.
Data types in C
int - to represent integer type data
char -to represent character or string type data
float -to represent floating point number
double -to represent double floating point number
void -null value
Data type Qualifiers (Modifiers)
A data type qualifier used to alters the meaning of the base type to more precisely fit a specific
need. We cant apply the modifier on void data type. The modifiers used in C are
•short
•long
•signed
•unsigned
Tokens in C
Tokens are the smallest individual elements, which are identified by the compiler. Tokens in C
can be categorized as :
•Identifiers
•Keywords
•Constants
•Variable
•Operators
This comment has been removed by the author.
ReplyDelete