Presentation Transcript
Slide 1:Data Types:
Integer - without decimal
Float - with decimal
Character - Character / key words
Constants:
Constants in C referred to fixed values that do not change during the execution of the program.
Variables:
Variables is a data name that may be used to store a data value at different times during execution
Slide 2:Range of Size:
8 bits - 1 bytes
1024 byte - 1 KB
1024 KB - 1 MB
1024 MB - 1 GB
Int - 2 byte
Char - 1 byte
Float - 4 byte
If we given size of int the output will be given as 2
Slide 3:Basic structure of C program:
Documentation section
Link section
Definition section
Global Declaration section
main()
{
declaration part
execution part
}
Slide 4:Subprogram section
Fun 1
Fun 2
…….
…….. User define function
…….
Fun n
Slide 5:Document section:
It is a non-executable part used to refer the program.
Eg: / * addition of two numbers * /
Link section:
It provides the instruction to the compiler to link function from system library.
Eg:
#include
main()
{
printf(“hello”);
}
Slide 6:Definition section:
Eg:
#include
#define .PI 3.14 ------- definition part
main()
{
int I,j;
i=5;
j=i*PI;
printf(“ The value of J is %d”,j);
}
Slide 7:Global declaration section:
There are some variable that are used more than one function such variable are called Global variables and are declared in global declaration section
Main:
It is a declaration part.
Declaration part:
It declares all variables used in a executable part
Executable part:
There must be atleast one statement in executable part.
These two parts must be appear between (or) begins with { and ends with }. All statement should end with; (semicolon)
Sub program section:
It contains all the user defined function that are called in the main function.
Slide 8:Scanf:
Sample program:
#include
main()
{
int a,b,c;
printf(“Enter the value of a:”);
scanf(“%d”),&a);
printf(“Enter the value of b:”);
scanf(“%d”,&b);
c=a+b;
printf(“The value of c is %d”,c);
}
Slide 9:Information:
A programming language is designed to help process certain kinds of data consisting of numbers, characters, strings and to provide useful output.
Program:
Task of processing of data is accomplished by executing a precise instructions
Character set:
Character that can be used to form word, numbers and expressions. The character set in c is grouped into the following categories. Letters, digits, special characters, white space.
White space may be used to separate words but are prohibited between character of keywords and identifiers
Slide 10:Trigraph character:
Many not english keywords do not support all the characters mention in character set.
C introduce a concept of Trigraph sequence that are not available on some keywords. Each Trigraph sequences consist of three characters. C two question mark followed by another character
Eg:
[ -??c]