In this video, you will learn how to declare a character variable in C. By the end of this video, you should be able to declare a character (char) variable, initialize a char variable with a value, and display it on the screen using printf statement in your C program.
Here is the syntax to declare a variable in C:
data-type variable_name;
If you want to declare a variable named "size" having data-type char, you can do that by typing:
char size;
In order to initialize a variable, here is the syntax:
variable_name = value;
If you want to assign value L to char variable size, you can write the below statement in C:
size = 'L';
Use "%c" format specifier to display value of char variable "size" as follow:
printf("%c", size);
Learn how to declare an integer (int) variable in C: • How to Declare, Initialize and Displa...
Interested in learning C programming language? Visit my comprehensive C course - https://www.aptuts.com/c-programming
Learn C programming online for FREE - https://www.learnconline.com/
Follow me on my Facebook page - http://fb.com/aptuts
Free C programming cheatsheet - https://www.aptuts.com/free-c-cheatsheet
#aptuts #DeclareCharacterVariableInC #CharVariableInC