This document provides an introduction and overview of the C programming language. It discusses the history and development of C, why C is still widely used today despite newer languages, and shows a simple "Hello World" example as a first C program. The document also covers basic C programming concepts like data types, variables, constants, and input/output functions. It provides examples of declaring variables, assigning values, and using the printf statement to output values.
C++ is an object-oriented programming language that is an extension of C. It was developed in the 1980s to support object-oriented programming. In C++, data and functions can be combined into objects. Data in an object can only be accessed by the object's functions, allowing for encapsulation. The document then provides an overview of key C++ concepts like data types, tokens, operators, and input/output streams to introduce basic C++ syntax and programming.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, input/output, variables, comments, and common errors. It explains that C++ was created by Bjarne Stroustrup in the 1980s as an extension of C with object-oriented features from Simula 67.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, I/O streams, variables, comments, and common errors. It explains that Bjarne Stroustrup extended C to create C++, adding object-oriented features from Simula. The main components discussed are the building blocks of any C++ program - characters, tokens, data types, and basic input/output operations.
C Programming - Basics of c -history of cDHIVYAB17
The document provides an introduction to C programming, covering topics such as what a program is, programming languages, the history of C, and the development stages of a C program. It discusses the key components of a C program including directives, the main function, and program structures. Examples are provided to illustrate C code structure and the use of variables, keywords, operators, input/output functions, and formatting output with printf.
And practice program with some MCQ questions to familiar with the concepts.
The document provides an introduction to algorithms and key concepts related to algorithms such as definition, features, examples, flowcharts, pseudocode. It also discusses different types of programming languages from first to fifth generation. Key points of structured programming approach and introduction to C programming language are explained including data types, variables, constants, input/output functions, operators, type conversion etc.
The document provides an introduction to the C programming language, including its history, features, character sets, tokens, data types, operators, and the basic structure of a C program. It discusses key concepts such as variables, constants, comments, functions, input/output, and how to compile and execute a C program.
The document provides an introduction to the C programming language, including its history, features, character sets, tokens, data types, operators, and the basic structure of a C program. It discusses key concepts such as variables, constants, comments, functions, preprocessing directives, and how to compile and execute a C program.
The document provides an introduction to the C programming language. It discusses the structure of a C program including documentation, preprocessor directives, header files, and function definitions. It also describes various math and trigonometric functions available in the standard library like sqrt, pow, sin, cos, and log. The rest of the document outlines the steps to compile and execute a C program and defines key concepts like variables, constants, and data types in C.
The document provides information on C language basics. It discusses that C is a system programming language useful for writing system programs like compilers, drivers, etc. It is a structured language that supports functions and modular programming. C has many built-in functions and is portable, efficient, and can access hardware. Some key aspects covered include data types in C, variables, operators, conditional statements, and input/output functions. Examples of basic C programs are also included.
02a fundamental c++ types, arithmetic Manzoor ALam
The document discusses fundamental C++ types including integers, characters, and floating-point numbers. It describes integer types like int, short, and long and their typical sizes. Character types represent single characters with examples of escape codes. Floating-point types can represent real numbers in formats like float and double. The document also covers C++ concepts such as variable definitions and declarations, arithmetic operators, assignment, and increment/decrement operators.
The document discusses editing, compiling, and executing a simple C++ program. It begins with an overview of basic C++ programming elements and concepts like tokens, data types, arithmetic operators, and precedence. It then provides examples of simple C++ programs that perform arithmetic calculations and output results. The document emphasizes that understanding programming fundamentals like variables, data types, expressions, and control flow is necessary before writing even basic C++ programs.
This document provides an introduction to the C programming language. It discusses fundamental C elements like data types, variables, constants, operators, and input/output functions. It explains how a basic C program is structured and compiled. Examples are provided to demonstrate simple C statements, arithmetic expressions, and how to write and run a first program that prints text. The key topics covered include basic syntax, program structure, data types, identifiers, operators, and input/output functions like printf() and scanf().
The document provides an overview of key concepts for getting started with C programming, including data types, variables, functions, operators, and common errors. It explains concepts like data type declaration, arithmetic expressions, the main() function, and input/output functions like printf(). Examples are provided to demonstrate proper syntax and usage of these basic C programming elements.
This document discusses various tokens and language elements in C++ including keywords, identifiers, constants, strings, punctuators, operators, data types, and control structures. It provides details on the different types of constants, keywords, identifiers and their rules. It also explains basic concepts like tokens, expressions, operators, data types and control structures in C++.
C++ / CPP / C PLUS PLUS notes, object oriented programming using C++ / CPP / C PLUS PLUS, C++ / CPP / C PLUS PLUS tutorial, lecture notes, C++ / CPP / C PLUS PLUS programming notes, C++ / CPP / C PLUS PLUS example programs, C++ / CPP / C PLUS PLUS programs with explanation, C++ / CPP / C PLUS PLUS source code with output, C++ / CPP / C PLUS PLUS programs, C++ / CPP / C PLUS PLUS coding, C++ / CPP / C PLUS PLUS codes, C++ / CPP / C PLUS PLUS slides, C++ / CPP / C PLUS PLUS notes
This document provides an introduction and overview of the C programming language. It discusses what a computer is and how programming languages work. It introduces machine language and high-level languages like C. Key aspects of C are explained, including data types, variables, operators, functions, and basic syntax. Examples of simple C programs are provided.
This document provides information on C programming concepts including data types, operators, functions, and basic program structure.
It defines key concepts like variables, data types (integer, float, character), operators (arithmetic, relational, logical), functions (printf, scanf), and basic program anatomy with main(), I/O statements, and comments. Examples are given to illustrate variable declaration and usage, arithmetic operations, type casting, and basic programs to read/write and perform calculations.
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 by Dennis Ritchie at Bell Labs to create the UNIX operating system. C is a structured, procedural programming language that is widely used to develop operating systems, databases, networks, and more. The document then covers some key concepts in C including functions, header files, variables, data types, operators, and escape sequences. It provides examples of basic C programs and exercises for practicing programming concepts.
This document discusses basic program elements in C++, including:
1. Initializing variables can be done in two ways - by appending an equal sign followed by the value (int a = 0), or by enclosing the value in parentheses (int a(0)). Both methods are valid in C++.
2. Variables can have either local or global scope - local variables are declared within a function while global variables are declared outside all functions.
3. Keywords are reserved words in C++ that have special meaning and cannot be used as regular identifiers. Common keywords include int, float, if, else, while, etc.
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubeykiranrajat
The document provides an overview of fundamentals of C programming including data types, identifiers, operators, input/output, type casting, precedence rules, variables scope, and preprocessors. It discusses basic data types in C like integer, floating point, and their sizes. It also covers C identifiers naming rules, keywords, arithmetic, relational, and logical operators along with their precedence.
The role of wall art in interior designingmeghaark2110
Wall patterns are designs or motifs applied directly to the wall using paint, wallpaper, or decals. These patterns can be geometric, floral, abstract, or textured, and they add depth, rhythm, and visual interest to a space.
Wall art and wall patterns are not merely decorative elements, but powerful tools in shaping the identity, mood, and functionality of interior spaces. They serve as visual expressions of personality, culture, and creativity, transforming blank and lifeless walls into vibrant storytelling surfaces. Wall art, whether abstract, realistic, or symbolic, adds emotional depth and aesthetic richness to a room, while wall patterns contribute to structure, rhythm, and continuity in design. Together, they enhance the visual experience, making spaces feel more complete, welcoming, and engaging. In modern interior design, the thoughtful integration of wall art and patterns plays a crucial role in creating environments that are not only beautiful but also meaningful and memorable. As lifestyles evolve, so too does the art of wall decor—encouraging innovation, sustainability, and personalized expression within our living and working spaces.
The document provides an introduction to the C programming language, including its history, features, character sets, tokens, data types, operators, and the basic structure of a C program. It discusses key concepts such as variables, constants, comments, functions, input/output, and how to compile and execute a C program.
The document provides an introduction to the C programming language, including its history, features, character sets, tokens, data types, operators, and the basic structure of a C program. It discusses key concepts such as variables, constants, comments, functions, preprocessing directives, and how to compile and execute a C program.
The document provides an introduction to the C programming language. It discusses the structure of a C program including documentation, preprocessor directives, header files, and function definitions. It also describes various math and trigonometric functions available in the standard library like sqrt, pow, sin, cos, and log. The rest of the document outlines the steps to compile and execute a C program and defines key concepts like variables, constants, and data types in C.
The document provides information on C language basics. It discusses that C is a system programming language useful for writing system programs like compilers, drivers, etc. It is a structured language that supports functions and modular programming. C has many built-in functions and is portable, efficient, and can access hardware. Some key aspects covered include data types in C, variables, operators, conditional statements, and input/output functions. Examples of basic C programs are also included.
02a fundamental c++ types, arithmetic Manzoor ALam
The document discusses fundamental C++ types including integers, characters, and floating-point numbers. It describes integer types like int, short, and long and their typical sizes. Character types represent single characters with examples of escape codes. Floating-point types can represent real numbers in formats like float and double. The document also covers C++ concepts such as variable definitions and declarations, arithmetic operators, assignment, and increment/decrement operators.
The document discusses editing, compiling, and executing a simple C++ program. It begins with an overview of basic C++ programming elements and concepts like tokens, data types, arithmetic operators, and precedence. It then provides examples of simple C++ programs that perform arithmetic calculations and output results. The document emphasizes that understanding programming fundamentals like variables, data types, expressions, and control flow is necessary before writing even basic C++ programs.
This document provides an introduction to the C programming language. It discusses fundamental C elements like data types, variables, constants, operators, and input/output functions. It explains how a basic C program is structured and compiled. Examples are provided to demonstrate simple C statements, arithmetic expressions, and how to write and run a first program that prints text. The key topics covered include basic syntax, program structure, data types, identifiers, operators, and input/output functions like printf() and scanf().
The document provides an overview of key concepts for getting started with C programming, including data types, variables, functions, operators, and common errors. It explains concepts like data type declaration, arithmetic expressions, the main() function, and input/output functions like printf(). Examples are provided to demonstrate proper syntax and usage of these basic C programming elements.
This document discusses various tokens and language elements in C++ including keywords, identifiers, constants, strings, punctuators, operators, data types, and control structures. It provides details on the different types of constants, keywords, identifiers and their rules. It also explains basic concepts like tokens, expressions, operators, data types and control structures in C++.
C++ / CPP / C PLUS PLUS notes, object oriented programming using C++ / CPP / C PLUS PLUS, C++ / CPP / C PLUS PLUS tutorial, lecture notes, C++ / CPP / C PLUS PLUS programming notes, C++ / CPP / C PLUS PLUS example programs, C++ / CPP / C PLUS PLUS programs with explanation, C++ / CPP / C PLUS PLUS source code with output, C++ / CPP / C PLUS PLUS programs, C++ / CPP / C PLUS PLUS coding, C++ / CPP / C PLUS PLUS codes, C++ / CPP / C PLUS PLUS slides, C++ / CPP / C PLUS PLUS notes
This document provides an introduction and overview of the C programming language. It discusses what a computer is and how programming languages work. It introduces machine language and high-level languages like C. Key aspects of C are explained, including data types, variables, operators, functions, and basic syntax. Examples of simple C programs are provided.
This document provides information on C programming concepts including data types, operators, functions, and basic program structure.
It defines key concepts like variables, data types (integer, float, character), operators (arithmetic, relational, logical), functions (printf, scanf), and basic program anatomy with main(), I/O statements, and comments. Examples are given to illustrate variable declaration and usage, arithmetic operations, type casting, and basic programs to read/write and perform calculations.
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 by Dennis Ritchie at Bell Labs to create the UNIX operating system. C is a structured, procedural programming language that is widely used to develop operating systems, databases, networks, and more. The document then covers some key concepts in C including functions, header files, variables, data types, operators, and escape sequences. It provides examples of basic C programs and exercises for practicing programming concepts.
This document discusses basic program elements in C++, including:
1. Initializing variables can be done in two ways - by appending an equal sign followed by the value (int a = 0), or by enclosing the value in parentheses (int a(0)). Both methods are valid in C++.
2. Variables can have either local or global scope - local variables are declared within a function while global variables are declared outside all functions.
3. Keywords are reserved words in C++ that have special meaning and cannot be used as regular identifiers. Common keywords include int, float, if, else, while, etc.
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubeykiranrajat
The document provides an overview of fundamentals of C programming including data types, identifiers, operators, input/output, type casting, precedence rules, variables scope, and preprocessors. It discusses basic data types in C like integer, floating point, and their sizes. It also covers C identifiers naming rules, keywords, arithmetic, relational, and logical operators along with their precedence.
The role of wall art in interior designingmeghaark2110
Wall patterns are designs or motifs applied directly to the wall using paint, wallpaper, or decals. These patterns can be geometric, floral, abstract, or textured, and they add depth, rhythm, and visual interest to a space.
Wall art and wall patterns are not merely decorative elements, but powerful tools in shaping the identity, mood, and functionality of interior spaces. They serve as visual expressions of personality, culture, and creativity, transforming blank and lifeless walls into vibrant storytelling surfaces. Wall art, whether abstract, realistic, or symbolic, adds emotional depth and aesthetic richness to a room, while wall patterns contribute to structure, rhythm, and continuity in design. Together, they enhance the visual experience, making spaces feel more complete, welcoming, and engaging. In modern interior design, the thoughtful integration of wall art and patterns plays a crucial role in creating environments that are not only beautiful but also meaningful and memorable. As lifestyles evolve, so too does the art of wall decor—encouraging innovation, sustainability, and personalized expression within our living and working spaces.
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabanifruinkamel7m
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
All About the 990 Unlocking Its Mysteries and Its Power.pdfTechSoup
In this webinar, nonprofit CPA Gregg S. Bossen shares some of the mysteries of the 990, IRS requirements — which form to file (990N, 990EZ, 990PF, or 990), and what it says about your organization, and how to leverage it to make your organization shine.
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleCeline George
One of the key aspects contributing to efficient sales management is the variety of views available in the Odoo 18 Sales module. In this slide, we'll explore how Odoo 18 enables businesses to maximize sales insights through its Kanban, List, Pivot, Graphical, and Calendar views.
How to Configure Public Holidays & Mandatory Days in Odoo 18Celine George
In this slide, we’ll explore the steps to set up and manage Public Holidays and Mandatory Days in Odoo 18 effectively. Managing Public Holidays and Mandatory Days is essential for maintaining an organized and compliant work schedule in any organization.
This slide is an exercise for the inquisitive students preparing for the competitive examinations of the undergraduate and postgraduate students. An attempt is being made to present the slide keeping in mind the New Education Policy (NEP). An attempt has been made to give the references of the facts at the end of the slide. If new facts are discovered in the near future, this slide will be revised.
This presentation is related to the brief History of Kashmir (Part-I) with special reference to Karkota Dynasty. In the seventh century a person named Durlabhvardhan founded the Karkot dynasty in Kashmir. He was a functionary of Baladitya, the last king of the Gonanda dynasty. This dynasty ruled Kashmir before the Karkot dynasty. He was a powerful king. Huansang tells us that in his time Taxila, Singhpur, Ursha, Punch and Rajputana were parts of the Kashmir state.
Slides to support presentations and the publication of my book Well-Being and Creative Careers: What Makes You Happy Can Also Make You Sick, out in September 2025 with Intellect Books in the UK and worldwide, distributed in the US by The University of Chicago Press.
In this book and presentation, I investigate the systemic issues that make creative work both exhilarating and unsustainable. Drawing on extensive research and in-depth interviews with media professionals, the hidden downsides of doing what you love get documented, analyzing how workplace structures, high workloads, and perceived injustices contribute to mental and physical distress.
All of this is not just about what’s broken; it’s about what can be done. The talk concludes with providing a roadmap for rethinking the culture of creative industries and offers strategies for balancing passion with sustainability.
With this book and presentation I hope to challenge us to imagine a healthier future for the labor of love that a creative career is.
Search Matching Applicants in Odoo 18 - Odoo SlidesCeline George
The "Search Matching Applicants" feature in Odoo 18 is a powerful tool that helps recruiters find the most suitable candidates for job openings based on their qualifications and experience.
How to Share Accounts Between Companies in Odoo 18Celine George
In this slide we’ll discuss on how to share Accounts between companies in odoo 18. Sharing accounts between companies in Odoo is a feature that can be beneficial in certain scenarios, particularly when dealing with Consolidated Financial Reporting, Shared Services, Intercompany Transactions etc.
4. Features of C++
Case Sensitivity
Convenient language
Well structured
Object oriented
Speed
Popular
Modular programming
Powerful for Development
5. Basic Structure of C++
The format of writing program in C++ is called its/language
structure.
It consist of the following:
1. Preprocessor Directive (Header files)
2. Main() function
3. Program Body
6. Preprocessor Directive
Start with # symbol
This one directs the preprocessor to add some predefined source
code to our existing source code before the compiler begins to
process it.
The #include directive specifies a file, called a header, that
contains
the specifications for the library code.
Name of header file written in angle brackets < > .
Example
#include<iostream.h> Basic Header files
#include<conio.h>
#include<math.h>
Etc etc.
7. Main Function & Program Body
Main ()
Declares that start of main program and end of header part.
void main()
{
}
Program Body
Includes instructions for C++ and for execution of program
void main()
{
Body of Program / Main function (to process)
}
8. C++ Statements
Statement in a language is an instruction for the computer to
perform a task.
It is written in curly braces { … }.
As before it is mentioned in„body of the main function‟.
Example
#include<iostream>
Using namespace std;
int main()
{
cout<<“Welcome to Riphah College of Computing.”;
return 0;
}
9. Debugging in C++
if you missed out or enter something incorrectly into your
program, the compiler will report a syntax error message
when it tries to compile it.
An error is known as„Bug‟.
Finding and removing bugs in a language is known as
„Debugging‟.
Types of Errors
1. Fatal Syntax error
2. Logical error
3. Run-time error
10. Identifier
An identifier is a word used to name things.
These are the names used to represent variable, constant, function and
labels .
Identifiers are limited to 31 characters only
Names such as area, sum, and UserName are much better than the
equally permissible a, s, and u.
Rules
Identifiers must contain at least one character.
The first character must be an alphabetic letter (upper or lower case) or
the (_) underscore.
Allows only alphabets, numbers and underscore
Reserved words/keywords cannot be used for this purpose.
No other characters (including spaces) are permitted in identifiers.
11. Types of identifiers
Standard Identifiers
A type of identifier that has special meaning in C++ is known as
standard identifier.You cannot use such identifier for your own
specific purpose because it is predefined in C++.
For example cout, void, if, int and float etc. are examples of
standard identifier.
User-defined Identifiers
The type of identifier that is defined by the programmer to access
memory location to define his/her own special purpose of thing.
Such identifiers are used to store data and results of programs.
For example average, num, result, area etc.
14. Data Types
C++ provides built-in data types that correspond to integers,
characters, floating-point values, and Boolean values.
These are the ways that data is commonly stored and manipulated by a
program.
At the core of the C++ type system are the seven basic data types
shown here:
The data type modifiers are
listed here:
signed
unsigned
long
short
16. Table below shows typical bit widths and ranges for the C++ data types
in a 32-bit environment, such as that used byWindows XP.
17. Main Data Types
We will do mostly exercise related to following four data types
that are frequently used as built in data types:
1. Int
2. Real data types
3. Char
4. bool
18. The number four (4) is an example of a numeric value. In
mathematics, 4 is an integer value that has range –2,147,483,648 to
+2,147,483,647..
Integers are whole numbers, which means they have no fractional
parts, and an integer can be positive, negative, or zero. Examples of
integers include 4, 19, 0, and1005.
In contrast, 4.5 is not an integer, since it is not a whole number.
#include <iostream.h>
#include <conio.h>
void main ()
{
int x;
x = 15;
cout<<“Value of X = ” ;
cout << x ;
getch ();
}
int data type
20. Following program shows the difference between signed and
unsigned integers.
#include <iostream.h>
#include <conio.h>
void main ()
{
short int i; // a signed short integer
unsigned short j; // an unsigned short integer
j = 60000; // j has range 0 to 65,535 and i has -32,768 to 32,767
i = j; //
cout << i << “ ” << j ;
getch ();
}
Try this example
21. Real data is numeric value with decimal point or fraction. It is also
called floating point number. It also includes both positive and negative
values.
For example, the formula from mathematics to compute the area of a
circle given the circle‟s radius, involves the value pi, which is
approximately 3.14159.
The minus sign (–) is used to indicate negative value. If no sign is used,
the value is positive by default.
Some examples of real values are 11.5, 7. 009 and – 215.798 etc.
#include <iostream.h>
#include <conio.h>
void main ()
{
float x;
x = 25.87;
cout<<“Value of X = ”;
cout << x ;
getch ();
}
Real Data Types
22. Following example calculate the area of a circle
#include <iostream.h>
#include <conio.h>
void main ()
{
float radius, pi, area_circle;
radius = 5;
pi = 3.14159;
cout<<“Area of Circle is = ”;
cout << pi * radius * radius ;
getch ();
}
23. Table below shows Characteristics of Floating-point
Numbers on 32-bit Computer Systems
24. This data type is used to store character value. It takes 1 bye in memory. It is
used to represent a letter, number or punctuation mark and a few other
symbols.
In C++ source code, characters are enclosed by single quotes ('),
for example char ch = 'A„;
It can represent single character such as„a‟,„x‟,„9‟, and„#‟.The character„9‟
is manipulated differently than integer 9. however it is possible to perform
mathematical operation on character values.
Standard ASCII can represent 128 different characters.
#include <iostream>
#include <conio.h>
void main ()
{
char ch1, ch2;
ch1 = „M‟;
ch2 = „N‟;
cout<<“character are: ” << ch1 << <<“and ” << ch2 „n‟ ;
getch ();
}
Character data type
26. Try this example
#include <iostream>
#include <conio.h>
void main ()
{
char ch1, ch2;
ch1 = 65;
ch2 = „A‟;
cout << ch1 << ", " << ch2 << ", " << 'A' << 'n';
getch ();
}
Try to guess the output of program
27. Explanation
The program will display following output.
A,A,A
The first A is printed because the statement ch1 = 65; which
assigns theASCII code forA to ch1.
The second A is printed because the statement ch2 = 'A';
assigns the literal character A to ch2.
The third A is printed because the literal character 'A' is sent
directly to the output stream.
Standard (double) quotes (") are reserved for strings, which are
composed of characters, but strings and chars are very different.
28. bool data type
The bool type is a relatively recent addition to C++. It stores
Boolean (that is, true/false) values.
C++ defines two Boolean constants, true and false, which are the
only two values that a bool value can have.
it is important to understand how true and false are defined by
C++. One of the fundamental concepts in C++ is that any nonzero
value is interpreted as true and zero is false.
This concept is fully compatible with the bool data type because
when used in a Boolean expression, C++ automatically converts any
nonzero value into true. It automatically converts zero into false.
The reverse is also true.
29. bool data type
#include <iostream>
#include <conio.h>
void main ()
{
bool b;
b = false;
cout<< "b is " << b << „n‟;
b = true;
cout<< "b is " << b << „n‟;
if (b)
cout<< "This is executed. n " ;
b = false;
cout<< "This is not executed. n " ;
cout<< "10 > 9 is " << (10 > 9) << " n " ;;
getch ();
}
Try to guess the output of program
30. Variables
A variable is a named memory location or memory cell.
It is used to hold program‟s input and computational results.
Variable value may change, however name can‟t be changed.
In algebra, variables are used to represent numbers.The same
is true in C++, except C++ variables also can represent
values other than numbers.
C++ is a case sensitive language uppercase and lower case
are different: number is different from Number or nUmber.
Valid identifiers: int abc, char aBc, int first_var, float
_first
Invalid identifiers: int 3bc, int a*b, int #a, int void
31. Variables
The variable are created in RAM, that‟s why any value stored in
it is also temporary because RAM is temporary memory.
When program ends, data in variable is automatically removed.
Following things are associated with any variable.
1. Name of variable
2. Address of variable
3. Computer memory
Marks
25 Content of variable
33. Variable Declaration & Initialization
The process of specifying variable name and its type is called
variable declaration.
It can be declared anywhere in the program before its use
The syntax of declaring variables is as follows:
data_type variable_name;
data_type: it indicates type of data can be stored and size of variable.
variable_name: it refers to the memory location of variable.
The process of assigning a value to a variable at the time of
declaration is known as variable initialization.
The equal sign = is used
The syntax of intializing a variable is as follows:
type_name variable_name = value;
34. Examples of Variable Declarations &
Initialization
int myAge, char countryName;
int a, b, c;
int firstNumber =10;
int secondNumber=11;
int thirdNumber;
thirdNumber=23;
float fnumber;
fnumber=19.8;
35. Constants & its types
A quantity or number that cannot be changed.
Two types of constants in C++.
1. Literal constant
Types of literal constant (according to data types)
Integer constant
Floating point constant
Character constant
String constant
2. Symbolic constant is a name given to values that can‟t be
changed.A constant must be initialized. e.g. PI can be used
to indicate value of 3.141593.