Sunteți pe pagina 1din 10

1) INTRODUCTION TO C

 C is a general-purpose programming language that is


extremely popular, simple and flexible.
 C is a machine independent (portable), high-level
programming language, case-sensitive, block-structured
and procedural.
 C lang. developed by Dennis Ritchie at the Bell Lab.
 C lang. use compiler to translate HL to Machine lang.
2)HISTORY OF PROGRAMMING LANGUAGE :

 The base of programming language is ‘ALGOL’. It


was first introduced in 1960.
 In 1967, Martin Richards developed BCPL for Writing
system software.(i.e. Operating system and compilers).
 Ken Thompson in 1970 developed a stripped version of
BCPL and named it B.
 In 1972, Dennis Ritchie developed C programming
language by retaining the important features of BCPL
and B programming languages and adding data types and
other powerful features
3) Importance of computer languages:

 Computer language is important to create Software and


Applications that help computer and mobile users in
daily life.
 Programming is important to manage, calculate, analyze
the processing of data.
 If today seeing robots, artificial intelligence, cloud
computing it’s because of programming languages.
 Due to all these reasons, it’s really important to learn
how to use programming languages in our daily life.
Structure of C program
In general, a C program is composed of the following sections:

1) Section 1: Preprocessor directives/Link Section (optional)


Provides instruction to the compiler to link function from the inbuilt
library function.
e.x. : #include<stdio.h>

2) Section 2: Global declarations (optional)


Consists of function declaration and global variables.
e.x : float area (float r);
3) Section 3:Functions (mandatory)
This section must have one or more functions. A function named main is
always required.
e.x.:
main()
{
1) Non-executable statements
2) Executable statements
}
Display message on screen:

#include<stdio.h> Section 1

main() Section 3
{
printf(“welcome to C”);
}
4) CONSOLE INPUT-OUTPUT FUNCTIONS:
1) Formatted input-output Function
2) Unformatted input-output Function
Formatted I/O function :
This two functions are contain in stdio.h header file.
use those functions in our program we have to include stdio.h file
in our program, that is #include<stdio.h>

1) printf() :
Give the output in desired format to user.
use:
1) Display text as it is.
2) Display value of expression or value of variable.
e.x.:
printf(“WELCOME TO C LANGUAGE”);

2) scanf() :
It’s used to take input/data from user.
e.x.
scanf(“%d%d”,&num1,&num2);
Some format specifiers in c language

1)int (number value) : %d

2)char (alphabet) : %c

3)float (fraction point) : %f

4)string (text) : %s
Unformatted I/O Function:

S-ar putea să vă placă și