MCS-011 Problem Solving and Programming

First year, Semester 1

Chapters

Newsletter

Declaring Variables

Before any data can be stored in the memory, we must assign a name to these locations of memory. For this we make declarations. Declaration associates a group of identifiers with a specific data type. All of them need to be declared before they appear in program statements, else accessing the variables results in junk values or a diagnostic error. The syntax for declaring variables is as follows:

data- type variable-name(s);

For example,
int a;
short int a, b; 

Report an issue

Reporting: Declaring Variables (topic)

Related Posts