CC Variables
Storing data.
C Variables
Variables are containers for storing data values, like numbers and characters.
In C, there are different types of variables (defined with different keywords), for example:
int- stores integers (whole numbers), without decimals, such as 123 or -123float- stores floating point numbers, with decimals, such as 19.99 or -19.99char- stores single characters, such as 'a' or 'B'. Char values are surrounded by single quotes
Declaring (Creating) Variables
To create a variable, specify the type and assign it a value:
type variableName = value;
Format Specifiers
Format specifiers are used together with the printf() function to tell the compiler what type of data the variable is storing. It is basically a placeholder for the variable value.
%dor%i- prints an integer%f- prints a float%c- prints a character%s- prints a string (text)
Examples
Create Variable
c exampleOther Types
c exampleCombine Text and Variable
c exampleAdd Variables
c example