Variable in C language
Variable in C language
1. It is a name of storage space which is used to store data.
2. It’s value is changeable.
3. It always contains the last value stored in it.
4. It is always declared with data type.
Variable Declaration:
• int rollno = 201;
• float marks = 85.6;
• char grade = ‘A’;
Have you signed up with Rakuten yet? It's the best site for earning Cash Back. Get a $40 bonus when you sign up with the link below and spend $40. It's free! 🤩
sign up now!
"Note: Here 201 is the value of rollno, 85.6 is the value of marks and 'A' is the value of grade, character value is always written in single quote."
Other Methods Of Variable Initialization:
• int rollno;
• float marks;
• char grade;
• int rollno = 201;
• float marks = 85.6;
• char grade = ‘A’;
Rules to declare a variable:
1. The first letter of a variable should be alphabet or underscore (_).
2. The first letter of variable should not be digit.
3. After first character it may be the combination of alphabets and digits.
4. Bland spaces are not allowed in variable name.
5. Variable name should not be a keyword.
Comments
Post a Comment