Problem Solving using C Language

0 of 77 lessons complete (0%)

Basics of Programming

Variables

variable in simple terms is a storage place which has some memory allocated to it. Basically, a variable used to store some form of data. 

Difference b/w variable declaration and definition

Variable declaration refers to the part where a variable is first declared or introduced before its first use. Variable definition is the part where the variable is assigned a memory location and a value. Most of the times, variable declaration and definition are done together.

#include <stdio.h> 
int main() 
{ 
    // declaration and definition of variable 'a123' 
    char a123 = 'a’;  	 // This is also both declaration and definition as 'b' is allocated 
    float b;		 // memory and assigned some garbage value.   
    int _c, _d45, e;  	 // multiple declarations and definitions 
    printf("%c \n", a123); 	 // Let us print a variable 
      return 0; 
}