4.Constants, Variables
4.Constants, Variables
I YEAR / I SEMESTER
05/12/2024 1
Variables in C
type variable_list;
• The example of declaring the variable is given below:
• int a;
• float b;
• char c;
PROBLEM SOLVINGAND C PROGRAMMING/CONSTANTS
05/12/2024 AND VARIABLES / DURGALAKSHMI B/AIML/SNSCT 2
Variables in C
• We can also provide values while declaring the variables as given below:
• float f=20.8;
• char c='A';
Local Variable
.
• A variable that is declared inside the function or block is
called a local variable.
Global Variable
#define LENGTH 10
#define WIDTH 5
Using const keyword.
Syntax:
const type var
const int LENGTH = 10; const int
WIDTH = 5;
PROBLEM SOLVINGAND C PROGRAMMING/CONSTANTS
05/12/2024 AND VARIABLES / DURGALAKSHMI B/AIML/SNSCT 7
THANK YOU
04/12/2024
05/12/2024 8