Zone's C Programming Tutorials #2 Variables


Known Member
Reaction score
Hi guys Zone here again this is my second part of my C Programming Tutorials in this tutorial we will be looking at variables you should know what they are used for if you have done programming before but incase you don't they are used to store stuff so like someones name,age,initial etc really anything. So lets jump right into the tutorial.

We will be looking at the variables below
int or integer

string is used to store text so you could store someones name in a string variable.
char is used to store one single character so like someones initial.
int is used to store whole numbers so someones age etc.
float is used to store numbers with decimal points so like 13.37 or 4.20.
Void is a special variable and is used for functions and pointers ONLY.

There are some rules you must know for variables:
you can not use key words so any keyword within the C library.
Variables can not contain spaces so you cant do this My Name if you done this My_Name that would be fine.

you can also get

i will not be talking about them as a simple google search can tell u all u need.

i will now show you how to use the Above Variables

int main()
// declaring vars

int age = 17;
char inital = 'Z';
char Name[6] = "Zone";
float decimal = 13.37;

// printing to console
printf("You are %d years old\n", age);
printf("Your Inital is %c\n", inital);
printf("Your Name is %s\n", Name);
printf("%.2f is a dank number\n", decimal);



%d used to print integers
%c used to print chars
%s used to print strings
%f used to print floats

with the float character conversion u can do this
%.2f prints to 2 decimal places
%f prints the full number
%.4f prints to 4 decimal places

you can mess about with it if you want :smile:

That's really all you need to know about Variables next tutorial i will go over the scanf function :smile: