C variables

Video Player is loading.
Current Time 0:00
Duration -:-
Loaded: 0%
Stream Type LIVE
Remaining Time -:-
 
1x
12 Views
Published
C variables data types tutorial example explained

#C #variables #tutorials

// variable = Allocated space in memory to store a value.
// We refer to a variable's name to access the stored value.
// That variable now behaves as if it was the value it contains.
// BUT we need to declare what type of data we are storing.

int x; //declaration
x = 123; //initialization
int y = 321; //declaration + initialization

int age = 21; //integer
float gpa = 2.05; //floating point number
char grade = 'C'; //single character
char name[] = "Bro"; //array of characters

// % = format specifier
printf("Hello %s\n", name);
printf("You are %d years old\n", age);
printf("Your average grade is %c\n", grade);
printf("Your gpa is %f\n", gpa);
Category
Bro Code
Tags
varable, variables, variable in c
Show more
Be the first to comment