C_Fundamentals
C_Fundamentals
C Fundamentals
A brief history of C:
Example
#include<stdio.h>
#include<conio.h>
main( )
float r, a;
printf(“radius”);
scanf(“%f”, &r);
a=3.145*r*r;
1
C Fundamentals
C used the upper cases A,B,…….,Z, the lower cases a ,b,…..,z and
certain special characters like + - * / = % & # ! ? ^ “ ‘ ~ \ < > ( ) = [ ]
{ } ; : . , _ blank space @ $ . also certain combinations of these characters
like \b, \n, \t, etc…
Data type:
The variables and arrays are classified based on two aspects- first is
the data type it stores and the second is the type of storage. The basic data
types in C language are int, char, float and double. They are respectively
concerned with integer quantity, single character, numbers, with decimal
point or exponent number and double precision floating point numbers ( ie;
of larger magnitude ).
CONSTANTS:
2
C Fundamentals
3
C Fundamentals
With this declaration n, mark is an array of size 100, they are identified
by mark[0],
mark[1],……….,mark[99].
For example
int x=10;
with this the integer variable x is assigned the value 10, before it is used.
Also note that C is a case sensitive langauge. i.e. the variables d and D are
different.
DECLARATIONS:
This is for specifying data type. All the variables, functions etc must be
declared before they are used. A declaration tells the compiler the name and
type of a variable you'll be using in your program. In its simplest form, a
declaration consists of the type, the name of the variable, and a terminating
semicolon:
char name[30];
char c;
int i;
float f;
You may wonder why variables must be declared before use. There are two
reasons:
4
C Fundamentals
or forgot to think about exactly how you were going to use it.)
EXPRESSION:
STATEMENTS:
(2) {
a=3;
b=4;
c=a+b;
(3) if (a<b)
5
C Fundamentals
i = 0;
i = i + 1;
SYMBOLIC CONSTANTS:
6
C Fundamentals