Variable Declaration In C
Variables in C
How to declare the variable inside the C program?
Video : https://goo.gl/lSzCth
Example:-
#include<stdio.h>
int main()
{
int a; //variable declaration
int b=2; // variable initialization
//how to print these variables
printf("variable a = %d",a);
printf("variable b = %d",b);
return 0;
}
What is variable declaration?
Ans: Only declaring the variable without initializing it in a program is called as variable declaration.
OR
Only declaring the variable without assigning the value ( like "int a" <=Declaration ) is called as variable declaration.
What is variable initialization?
Ans: The variable declared with initializing the value is called variable initialization.
OR
The variable declared assigning value to it (like "int b=2" <=Initialization) is called variable initialization.
How to write comment inside a C-program?
Ans: The commented portion will not give any error when compiling the program.
There are two types of writing the comment inside the program:
1. using //:
using '// ' we can only write comment on a particular line.
example:- //this is the line
2. using /* - */ :
using ' /* - */' we can comment the block of statements in the program.
example:-
start of comment /* int a;
printf("enter value of a") ; */ end of comment
Comments
Post a Comment