0% found this document useful (0 votes)
570 views

C++ by Sunbeam

This document provides an agenda and overview of C and C++ concepts to be covered on day 1, including language classifications, a revision of C, and an introduction to C++. It discusses topics like C's history and standards, functions, data types, and initialization versus assignment. The key topics are organized into sections on language classifications, a revision of C, and the differences between declaration and definition.

Uploaded by

Vivek raut
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)
570 views

C++ by Sunbeam

This document provides an agenda and overview of C and C++ concepts to be covered on day 1, including language classifications, a revision of C, and an introduction to C++. It discusses topics like C's history and standards, functions, data types, and initialization versus assignment. The key topics are organized into sections on language classifications, a revision of C, and the differences between declaration and definition.

Uploaded by

Vivek raut
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/ 4

Read Me.

md 4/28/2020

Day 1
Agenda
. Language classifications
. Revision of C
. C++ Introduction
. Access specifier
. Structure and class
. Oops Introduction
Language
It contains tokens
Idenitifier, Keyword, Constant, operator, Separator
Language has its syntax an semantics.
It contains built in features( e.g pointer, security, math support ).
If we want to implement B.L. then we should use language.
We can use it to develop applications:
. CUI[ Console User Interface ]
. GUI[ Graphical User Interface ]
. Libraries[ glibc, boost ]
Language classifications
. Machine Language
Binary langauge( 1, 0 )
. Low Level Language
Assembly language
. High Level Language
C, C++, Java, Python
Classification of high level Languages
. Procedure Oriented Programming language( POP )
ALGOL, FORTRAN, PASCAL, BASIC, C etc.
"FORTRAN" is considered as first high level POP language.
All POP languages follows "TOP Down" approach
. Object oriented programming languages( OOP )
Simula, Smalltalk, C++, Java, C#, Python, Go
"Simula" is considered as first high level OOP language.
more than 2000 lang. are OO.
All OOP languages follows "Bottom UP" approach
. Object Based Programming Languages
Ada, Modula-2,Java Script, Visual Basic
"Ada" is first Object Based Programming Language.
1/4
Read Me.md 4/28/2020

Revision of C
Inventor : Dennis Ritchie
Development : Developed between(1969-1972) in AT&T Bell lab.
Infrastructure : On Unix OS and DEC-PDP-11 machine
It is Procedure Oriented Programming Language.
Extension of C file should be .c
ANSI is an organization whose job is to updating/standardizing language.
ANSI Standards
Before 89 : The C Programming Language. 1989 C89 1990 C90 1995 C95 1999 C99 2011 C11 2018 C18
Declaration and Definition
Implementation of function is called function defintion.

int sum( int num1, int num2 )


{
int result = num1 + num2;
return result;
}

If we use function before defintiion then to instruct compier we must provide function signature above
the function call. It is called function declaration.

int main( void )


{
//Function Declaration/Prototype
int sum( int num1, int num2 ); //Local Function Declaration

//Function Call
int result = sum( 10, 20 );
printf("Result : %d\n", result);
return 0;
}

Without definition, If we try to use variable/function then linker generates error.

int main( void )


{
int sum( int num1, int num2 );

int result = sum( 10, 20 ); //Linker Error


return 0;
}

2/4
Read Me.md 4/28/2020

If we implement function above function call then function implementation is considered as declaration
as well as definition.

#include<stdio.h>
//num1, num2 => Parameters
int sum( int num1, int num2 )//Decl. as well as Def.
{
int result = num1 + num2;
return result;
}
int main( void )
{
int result = sum( 10, 20 ); //10,20 => Arguments
printf("Result : %d\n", result);
return 0;
}

According to Dennis Ritchie, "Declaration" refers to the place where nature of the variable is described
but no storage is allocated.
"Definition" refers to the place where memort is assigned or allocated.

int main( void )


{
int num1; //Decl as well as def. : Uninitialized
int num2 = 10; //Decl as well as def. :initialized
return 0;
}

int main( void )


{
//Only Declaration
extern int num1; //Instruction to the compiler
printf("Num1 : %d\n", num1); //Linker Error
return 0;
}
//int num1 = 10; //Decl as well def.

struct Point
{
//Declaration
int xPos;
int yPos;
};
int main( void )
{
3/4
Read Me.md 4/28/2020

struct Point pt1; //Decl as well Def.


return 0
}

Intialization and Assignment

int main( void )


{
int num1;
int num2 = 20; //Intialization
num2 = 30; //Assignment
num2 = 40; //Assignment
return 0;
}

Intialization is the process of storing value inside variable during declararion.


double pi = 3.14; //Initialization

int x = 10; //Initialization


int y = x; //Initialization

We can initialize variable only once.


After declration, process of storing value inside variable is called assignent.

int num1 = 10; //Initialization


int num2;
num2 = num1; //Assignment
num2 = 20; //Assignment

Assignment can be done multiple times.

4/4

You might also like