Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

C PROGRAMMING

C programming

Presented By: Mukul Porwal


Submitted to: Submitted by:
Vishal Namdev Sir Arvind Nagar
INTRODUCTION OF C
• C is developed by Dennis Ritchie in 1972.
• C is a structured programming language.
• C is strongly associated with UNIX, as it was
developed to write the UNIX operating system.
• C is a powerful programming language.
• This helps make programming easier and keeps the
code clean.
Dennis Ritchie
CONTENT OF C LANGUAGE

Data Control
Header Files Variable Operator
Type statement

Arrays & Structures &


Loops Functions Pointers
Strings Unions
HEADER FILE
• The files that are specified in the include section is called as Header File.
• These are precompiled files that has some function defined in them.
• Header file is given an extension .h.
• C Source file is given an extension .c.

C has different types of Header File.

stdio.h conio.h string.h ctype.h math.h


VARIABLE
• A variable is a name of the memory location. It is used to store data.
• Variable is a container in C programmer to hold values.
• Its value can be changed, and it can be reused many times.
• Types of variables.…

1.Local 2.Global 3.Static 4.Auotmatic 5.External


Variable Variable Variable Variable Variable
DATA TYPE
• A data type specifies the type of data that a variable can store such as
integer, floating, character, etc.
• Each variable in C has an associated data type.
• Data types are used while defining a variable or functions in C.
• Types of data types….

1.Basic Data 2.Derived 3.Enumeration 4.Void Data


type Data type Data type type
OPERATOR
• An operator is a symbol that operates on a value or a variable.
• An operator is a symbol that tells the complier to perform specific mathematical or logical functions.
• In C language many of kinds of operators are present like . .

1.Arithmatic 2.Relational 3.Logical 4.Conditional

6.Increment &
5.Assignment 7.Bitwise 8.Size of
Decrement

• 0
EXAMPLE OF C PROGRAM
Header file
#include<stdio.h>
(A header file is a source file that has the .h
#include<conio.h> extension)

void main() Main function


(The main function serves as the starting point for
{ program execution)

clrscr(); clrscr()
(This function is used to clear the previous output from
printf(“Hello C”); the console)
getch();
} printf()
(This function is used for output in C language)

getch()
(This function requests for a single character. Until you
press any key it blocks the screen)
CONTROL STATEMENT
• C program is a set of statements.
• Such statements by which we determine the flow of a program are called
Control Statement.
• C supports some statement like . . .

2.switch 3.goto
1.if statement
statement statement
LOOP
• Loops are used to execute the statements repeatedly.
• Loops in C language are used to execute a code again and again.
• In C language loops are three types.

3. do-while
loop
ARRAY
• An array is defined as the collection of similar type of data items stored at
contiguous memory locations.
• An array is a derived data type in c programming.
• Arrays are used to store multiple valuss in a single variable.
• C language has three types of Arrays . . .
1. One- 2.Two- 3. Multi-
Dimensional Dimensional Dimensional

• Syntax:-
1D Arrays: int arr[n];
2D Arrays: int arr[m][n];
STRING
• String in C programming is a sequence of characters terminated with a null
character ‘\0’.
• Strings are defined as an array of characters.
• Syntax:-
datatype string_name[ ] = {value1,value2,…}
POINTER
• A Pointer is a variable that stores the memory address of another variabe as
its value.
• Pointers in C are used to store the address of variables or a memory
location.
• Syntax:-
datatype *pointername
FUNCTION
• A function is a self-contained block of code that performs a particular task.
• Syntax:-
return_type name_of_function (Type1 ARG1,Type2
ARG2,Type3 ARG3)
• C functions classified into two categories.

1. Library 2. User-Define
Functions Functions
STRUCTURE
• A structure is a collection of data items of different types.
• A structure contains an ordered group of data objects.
• Each variable in the structure is known as a member of the structure.
• C language supports a constructed data type know as structures.
• Syntax:-
struct structurename {
dataType member1;
dataType member2;

}
UNIONS
• Unions are a concept borrowed from structures.
• A union is a special data type available in C that allows to store different data
types in the same memory location.
• Syntax:-
union unionname {
dataType member1;
dataType member2;

}
REFERENCE
• Google
• Wikipedia
• Tutorialspoint.com
• Programiz.com
• Javatpoint.com
Thank you to all..

You might also like