basics of c programming n.
Skip this Video
Loading SlideShow in 5 Seconds..
Basics of C Programming PowerPoint Presentation
Download Presentation
Basics of C Programming

Loading in 2 Seconds...

play fullscreen
1 / 37

Basics of C Programming - PowerPoint PPT Presentation

  • Uploaded on

This Is the Short Description About the Basics Concepts Of C Programming.. It will Give you a Basic Concept of how to implement a code ...

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Basics of C Programming' - HubaAkhtar

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
what is c
What is C++?

C++ (pronouncedcee plus plus/ˈsiː plʌsplʌs/) is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-levelmemory manipulation.

when was c created
When was C++ Created?

Before the initial standardization in 1998, C++ was developed by Bjarne Stroustrup at Bell Labs since 1979, as an extension of the C language as he wanted an efficient and flexible language similar to C, which also provided high-level features for program organization.

for what purpose c is used
For What Purpose C++ is used?

C++ is one of the most versatile languages in the world. It is used nearly everywhere for everything… systems programming (operating systems, device drivers, database engines, embedded, Internet of Things, etc.)

what is the c program
What is the C++ Program?

C++ is an object oriented programming (OOP) language, developed by Bjarne Stroustrup, and is an extension of C language. It is therefore possible to code C++ in a "C style" or "object-oriented style."

structure of c program
Structure of C++ Program:

The format of writing program in C++ is called its STRUCTURE.

It consists of the following parts:

  • Preprocessor directive
  • Main() Function
  • Program Body
preprocessor directive
Preprocessor Directive:

Preprocessor Directive is an instruction given to the compiler before the execution of actual program. Preprocessor directive is also known as Compiler directive.

The preprocessor directive start with “Hash”

symbol ‘#.’

include preprocessor
Include preprocessor :

Include preprocessor directive is used to include header files in the program.


#include <iostream.h>

what are header files
What are Header Files?

Header files contain definitions of Functions and Variables, which is imported or used into any C++ program by using the pre-processor #include statement. Header file have an extension ".h" which contains C++ function declaration and macro definition.

syntax of header files
Syntax of Header files:

The syntax of header files is as follows:

#include <header_file_name>

Name of header file can also be used in double quotes as follow:

#include “header_file_name”


#include <iostream.h>

The word “iostream” stands for input/output stream. This header file contains the definitions of built-in input and output functions and objects.

main function
main() Function:

The main() function is the starting point of a C++ program. Each program must contain main() function. If a program does not contain main function, it can be compiled but cannot be executed.

syntax of main function
Syntax of main() function:

The syntax of main() function is as follows:

void main()


body of main function


example 1

The following example explains the basic structure of C++ program: #include<iostream.h> Preprocessor

void main() Main function


cout<<“Hello world”; Body Statement


what is data type in c
What is Data Type in C++?

A Datatype actually describes you data like what form of data you want to create (It may be integer, character, floating point number, string etc.) In the context of C++, you can make many types of data that are mentioned above.


To make integer datatype, you type intand then write its name (called variable name). To create floating point datatype , you type float and then write its variable. That is actually a syntax of C++. (It may differ for other languages).

  • int- integer, it is of 2 or 4 bytes dependent on machine.
  • char- character type (used to store characters and strings), one byte.
  • float- used to store floating point numbers, 4 bytes.
  • double- used to store high precision floating point numbers, 8 bytes.

A Variable is a named memory location or memory cell. It is used to store program`s input data. The value of variable may change during the execution of program. However, the name of variable cannot be changed.

how variables created
How variables created?

The variables are created in RAM. RAM is a temporary memory. That is why the data stored in variables is also temporary.

The data stored in the variable is automatically removed when program ends.

variable declaration
Variable Declaration:

The process of specifying the variable name and its type is called “Variable Declaration”.


data_type variable_name;


int marks;

float average;

variable initialization
Variable Initialization:

The process of assigning a value to a variable at the time of declaration is known as “Variable initialization”.

The equal sign ‘=‘ is used to initialize a variable. Variable name is given on left side and value is given on the right side of equal sign.


The syntax of initializing a variable is as follows:

data_type variable_name =value;


int n =100;

float a=50.73;

what are operators
What are Operators?

An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C++ is rich in built-in operators and provides the variety of operators: Arithmetic Operators. Relational Operators.


The operators can be categorized as follow:

  • Unary Operator:

A type of operator that works with one operand is known as unary operator.


-,++,--, -a, N++, --x

  • Binary Operator:

A type of operator that works with two operands is known as Binary Operator.



a + b;


what are arithmetic operator
What are Arithmetic Operator?

C++ uses operators to do arithmetic. It provides operators for five basic arithmetic calculations: addition, subtraction, multiplication, division, and taking the modulus. Each of these operators uses two values (called operands) to calculate a final answer

example 2

Suppose we have 2 variables A & B where A=10 & B=5. Arithmetic operation can be used on A & B as follows:

what is relational operator
What is Relational operator?
  • In computer science, a relational operator is a programming language construct or operator that tests or defines some kind of relation between two entities. These include numerical equality (e.g., 5 = 5) and inequalities (e.g., 4 ≥ 3).
assignment statement
Assignment Statement:

A statement that assigns a value to a variable is known as “Assignment Statement”.


Variable = expression;

“=” is the assignment operator.




compound assignment statement
Compound Assignment Statement:

An assignment statement that assigns a value to many variables is known as “Compound Assignment” statement.



x = y= z= 100;

compound assignment operator
Compound Assignment Operator:

C++ language provides Compound Assignment operator that combines assignment operator with arithmetic operators.


Variable op=expression;


N+=10; is equivalent to N=N+10;

increment operator
Increment Operator:

The increment operator is used to increase the value of a variable by 1. It is denoted by the symbol “++”.

Increment operator can be used as follows:

  • Prefix form
  • Postfix form
prefix postfix form
Prefix & Postfix Form:

In Prefix form, the increment operator is written before the variable as follows:


In Postfix form, the increment operator is written after the variable as follows:


decrement operator
Decrement Operator:

The Decrement operator is used to decrement the value of a variable by 1. It is denoted by the symbol “—”.

Decrement operator can be used in two forms:

  • Prefix form
  • Postfix form
prefix postfix form 1
Prefix & Postfix Form:

In prefix form, decrement operator is written before the variable as follows:


In postfix form, decrement operator is written after the variable as follows: