C is a programming language. It is also known as middle level a processor language. This
language was design for developing efficience, economical, portable system and
application software program.
It is as sensitive language.
It is developed by Denis Ritchie in 1972 at AT & TS Bell Labs of USA.
FEATURES OF C Language:-
1. It is very efficient and have fast execution speed.
2. C language has more data types than other languages.
3. It has 40 keywords.
4. C language program highly portable.
5. In it , you can take 0-50 thousand variables in single program
depending on the size in main memory.
6. It is a structural programming.
7. It is very simple to learn to use.
TYPES OF LANGUAGE:-
1. Machine Level Language or binary Language
2. Assembly language
Program in Assembler Program in m/c
assembly language language
3. High Level Language: - C++, java, VB, C# etc.
Program in high Compiler Program in m/c
level language language
STEPS TO LEARN ENGLISH: -
Alphabets words sentences paragraphs
Now The Steps in Learning C Language: -
Alphabets, digits, Constant, variables, Instructions Program
special symbols keywords
VARIABLES:-
It is the name to given to memory location where some data or value is stored. In C
language variable must be declared before it can be used. Variables can declared at start
,of any block of code. Values of the variables can be change during the execution of the
program.
RULES FOR DECLARING VARIABLES:-
1. The name of the variable must be starting an alphabet.
2. The variable name should not have any space in between.
3. All the variable name must be separated by comma (,).
4. It should not be a keyword.
5. The length of variable name should not be normally more than 8
characters.
6. Upper and lower case matter in variable.
KEYWORDS
Keywords are special words where meaning is already defined to the compiler.
Keywords cannot be used as variables or identifiers. C language has 40 keywords. Some of
them are the following:-
Break while char continue
Default do else float
Goto if int return
DATA TYPES:-
C language becomes powerful with the help of data types. Data types describe the type or
characteristics of variables or data.
SPECIFIC DATA TYPE VALUES:-
Data type Format Bytes of Range Value
String memory
Int %d 2 -32768-32767 843
Float %f 4 -3.4e38- 45.758
3.4e38
Char %c 1 -128-127 A
String %s 2 --- “aman”
What ‘s int main()?
There are many variations of main()function, but now a days it's a standard that we should return
some value (an integer value) to the calling/parent function. Since main()calls by the operating
system at the time of program's execution, returned value reaches to the operating system which
indicates that function/ program is executed successfully or not. So we should use this variation of
main()function but we really don’t know what operating system does with returned value?
What ‘s return 0?
,It is not necessary that every time you should use return 0 to return program's execution
status from the main()function.
A SIMPLE PROGRAM IN C LANGUAGE:-
#include<stdio.h>
int main()
{ clrscr(); printf(“HELLO”);
printf(“WELCOME IN C”);
return 0;
}
TO PRINT THE INTRODUCTION OF THE STUDENT:-
#include<stdio.h>
int main()
{
printf(“name”); printf(“\nclass”);
printf(“\nschool”);
printf(“\nplace”); return
0;
}
SIMPLE COLORING PROGRAM:-
#Include<stdio.h>
#include<stdlib.h>
Int main()
{
system(“color E4”);
printf(“golden”);
return 0;
}
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
, 6 = Yellow E = Light Yellow
7 = White F = Bright White
OPERATORS
An operator is a symbol which operates on a variable or value. We can define operators as
symbols that help us to perform specific mathematical and logical computations on
operands or variables.
c=a+b; a and b is
operands or variables and “+” is a operator.
1. Unary operator:- unary operators work or operate with a single operand.
Examples: a++;
a--; --a;
++a;
2.Binary operators:- Binary operators that operate or work with two operands are
binary operators.
Examples:- a+b;
a<b ;
3.Ternary operator:- Ternary operator is an operator that takes three operands.
Example:- condition?:result1:result2;
PROGRAM TO ADD, subtract, multiply & divide 2 NUMBERS
#include<stdio.h>
int main()
{
int a,b,c;
a=100; b=20;
c=a+b; printf("\n\n addition is : %d",c);
c=a-b; printf("\n\n subtraction is : %d",c);
c=a*b; printf("\n\n multiplication is : %d",c);
c=a/b; printf("\n\n division is : %d",c);
return 0; }