0% found this document useful (0 votes)
3 views11 pages

C Language

The document outlines the history and development of the C programming language, tracing its evolution from earlier languages like COBOL and BCPL to its creation by Dennis Ritchie in 1972. It details the features of C, such as its simplicity, portability, and system programming capabilities, as well as its structure, including key components like header files, data types, and input/output methods. Additionally, it explains programming concepts such as statements, conditional statements, loops, and arrays, providing syntax examples and homework assignments for practice.

Uploaded by

SK Gamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views11 pages

C Language

The document outlines the history and development of the C programming language, tracing its evolution from earlier languages like COBOL and BCPL to its creation by Dennis Ritchie in 1972. It details the features of C, such as its simplicity, portability, and system programming capabilities, as well as its structure, including key components like header files, data types, and input/output methods. Additionally, it explains programming concepts such as statements, conditional statements, loops, and arrays, providing syntax examples and homework assignments for practice.

Uploaded by

SK Gamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

History Of C Language

First Programming Language is Cobal in Develop 1950. Then it Language is improved and convert BCPL
Language. BCPL Stand for Basic Combined Programming Language, It is Not support Unix and Linux Operating
system. Then it Language is Improved and Convert B Language. B language is Not Support all Data Type, So It is
Type less language… It is Develop by Ken Thompson In 1970. Then It is improved and Convert C Language.

C Language
C is a High-Level Language; High level Language is that language which computer can understand Very Easily. C
is Mother level Language. C is System Programming language. C is Structured Programming Language. C
Language is Developed by Dennis Ritchie in 1972 At & TBell (American Telephonic and Telegraph) Lab In USA.

Feature Of C Language
There are Some Features of C language.
1. Simple
2. Portable
3. System Programming
4. Structured
5. Ritch Library…. etc.…

If We Learn C Language then we Need Some Software


 Turbo C
 Dev C
 NetBeans
 Visual Studio
 Code Block
 Notepad++… etc.…

Structure of C Program
If We Make C Program then some steps are Used: -
 Documentation Block (Optional Block)
 Header Section (Essential Block)
 Global Section (Optional Block)
 Main Section (Essential Block)
 I—Input
P-- Processing
O-- Output
 UDF (User Define Function)

Compiler
Compiler is an Application That is Convert Source code into machine code.
Source code Machine code
.C/.Cpp 0011
Keyword
Keyword is a Reserve word, Reserve word means It is Predefine Into Compiler.
In a C Language 32 Keywords are Available.
Ex: - if, if-else, else-if, for, while, do-while, etc.

Header File
Header File is also known as Library files. It is predefine method (function). Some
header file like this.
Ex: - stdio.h, conio.h, math.h, graphics.h, dos.h, stdlib.h, etc.

If we Learn C Language then Some Symbol Knowledge are Required.


# => Preprocessor Directive.
include => Include all header file in save include folder.
main => It is starting point the program.
clrscr() => It is use clear the screen.
getch() => It is use to hold the screen when we are not press any Key.
gets() => gets is a input method. It is read the character from file.

Data Type
This type of data is called Data_Type.
There are Two type of Data_Type.
1. Primitive Data_Type (int, float, char, double etc.)
2. Non Primitive Data_Type (array, structure, union, pointer etc.)

Input/Output method in C Language


There are Two types – I/O
1. scanf() Input
2. printf()  Output

1.scanf() => scanf is a input method that is 2.printf => printf is a output method that is write
used to read the integer, float, char, double etc. the character, integer, float, char, double from
type value from numeric keyword. keyword..
=> scanf is input method that is take user => printf is show the Output of the console window.
input..
Syntax with Example: -
Syntax: - Int a,b,c;
scanf (“format-specifier”, &variable list); printf (“Enter any two number”);
Ex: - c=a+b;
Int a; printf (“string value=%format-specifier”, where
scanf(“%d”,a); value is store);
printf(“sum=%d”,c);
Note: - When Data type is:-
Int  Format-specifier%d
float %f
char %c
double %If
long %Id
string %s
etc.

VARIABLE
OPERATOR
Statement
Statement has the Block of code that execute Hole Body
There are Three Type of Statement.
1 Conditional statement
2 looping statement
3 jump Control Statement

Conditional Statement-
Conditional statement is block of code, it used to check the
condition
This is Two Types of Conditional Statement
a) If Statement
b) Switch Statement

If Statement- Switch statement-


There are four types od If Use the switch statement to select one of many
Statement code blocks to be executed.
a) Simple if Note:-
1. 256 cases are available into switch.
b) If else
2. Floating point value is not accepted into switch
c) Else if (ladder if) case
d) Nested If 3. Only int and Char
Simple if
if is a Keyword, in a if Statement Only True Conditional Will Be checked False condition or any message not show.

Syntax:- Ex:-

If(condition) If(a==1)

{ {

//block of code; //printf(“a is equal 1”)

} }

2. if else :- if-else is a keyword. If given condition is true then If block of code will be
execute, Otherwise else block of code will be execute...

Syntax: - Ex: -
If (condition) //true block If(year%4=0)
{ {
//block of code; //block of code;
} }
//False block Else
{ {
//block of code; //block of code;
} }

Else If
Else if is known as ladder if. By using ladder if we can check multiple condition at a
time but only one condition will be executed.
Syntax: -
If(condition1)
{
//block of code;
}
Else if(condition2)
{
//Block of code;
}
.
.
Else //false block
{
//block of code;
}
Nested If
When any If Condition is Available into another If, Then This process is known as Nested If..

Syntax: -

If(condition1) //true of first block


{
If(condition2) //true of first block
{
//block of code;

}
else //False of second condition
{
//block of code;
}

else //False of first condition


{
//block of code;
}
Switch statement
Switch is a keyword, In a switch Statement case are used.
 Case is work same like as conditional Statement.
 Default block is used in switch Statement
 Brake Statement is used in Switch

Syntax: - 4.
Switch (Variable)
{
case 1;
{
//block of code;
break;
}
Case 2;
{
//block of code;
break;
}
..
..
Default: //it is optional block
{
//block of code;
}
}
Looping Statement
If you want to execute block of code again and again based on condition, Then this Process
is known as Looping.

Looping

Index Based Loop Collection Based Loop

Entry Control Loop Exit Control Loop


For Each Loop (It is
not Support C/C++)

For Loop While Loop Do-While Loop

For Loop: - for is a keyword, In a for Initialization, Condition , Updation into single line
terminated by Semicolon.
Ex: -
Syntax for Loop: -
//wap in c to print 1 to 10 number
For(initialization;condition;updation)
Int i;
{
For(i=1;i<=10;i++)

//body of loop

}
//body of loop;
}

Note: - all loop used following method.

Initialization (starting point of loop)

Condition(range)

Updation(increment/Decrement)

While Loop
While is a Keyword. While loop checked the condition as the Entry Point, So It is also known
as the Entry control loop.
Syntax: - Do-while loop:- Do-while Loop is a Keyword

Initialization;  Do while loop checked the condition as the Last Point, so


it is also known as Exit Control Loop. Exit Control Loop.
While(condition)
Ex: -
{
Initialization;
//body of loop;
Do
//updation;
{
}
//body of loop;

//updation;

While(condition);
Array
Array is the collection of similar data type, similar data type means the same type of data or
value.

Syntax: - Note: -
Data type array The Initialization of an array is start
name[size]; Size: - Length of an array
from 0 to n-1.
Ex: - Where n is length of an array
Int list (10);
Note: - Without using an array we can store single variable in to
single data type but by using an array we can store Multiple
Data into single variable.

Types of Array
1. One Dimensional array(1D)
2. Two-Dimensional array(2D)
3. Multi-Dimensional Array
One Dimensional array=>
In a one-Dimensional Array Only single subscript[] are
used that array is called One Dimensional Array.
Syntax: -
Data type arrname[size];
Ex: -
Int a [10]

Two-Dimensional Array: -
In a Two-Dimensional Array Two subscript[] are used that array is
called Two-Dimensional Array.
 In a Two-Dimensional Array, Row and Column are used.
Syntax: -
Data type arrname[row][column];
Ex: -
Int list [2][2];

//function
//

H.W.

1. WAP in c to check leap year or not


2. WAP in c to check the number is divisible by 5 and 11
3. WAP in c to check even and odd by using conditional operator
4. WAP in c to check parameter of rectangle
5. Write a program in c to check if your age greater or equal 18 then you eligible for
vote by using if

You might also like