Declare, Initialize & Use Variables | C Programming | Kovolff
Channel: prelearn
Date: 15/12/2020

To compile C programs in the terminal
gcc -o {target_name] [source_name]

Upon compiling an executable(.exe) file is created, called whatever you input as [target_name].

To run this file in the terminal
[target_name].exe

Variables can be seen as containers that hold values. These values can change throughout the running of the program.

To declare a variable in C, follow this general form
type name;
i.e. int user_age;
Here we declared the variable user_age which is an integer of type int.

C is a statically typed language, meaning that the type of each variable must be explicitly declared upon creation.

i.e. int user_age = 23;
Here we not only declared the variable user_age of type int, but also initialized to the value of 23

To include the value of your variables into your outputs
i.e. printf(“your age is %d years old”, user_age);
%d is a placeholder for the value of user_age
For every placeholder you insert in your string, you need a variable that is passed to printf() along with the string

#c #programming #variables