C++ tutorial, C++ programs, C++ Exercises, C++ Example Programs

Thursday, April 12, 2012

Variable Declaration in C Plus Plus

Variable declaration means to tell the C++ compiler about variable name and its data type.



The syntax of variable declaration in C++ is as follows:

General Syntax of Variable Declaration

DataType   List-of-Variables-separated-by-commas;

Examples of variable declaration

  • int RollNo, Marks;
  • In above example we have declared two integer variables. The names of variables are RollNo and Marks. Type of variables is integer. Integer data type variables can hold whole numbers like 100, 5 or -8. There will be no fractional part.
  • float percentage, average, installment;
  • In above example we have declared three variables of float data type. float data type variables can store numbers with decimal or fraction.
Share:

0 comments:

Post a Comment

We Love To Hear From You!

EasyCPPprogramming.blogspotcom

Labels