Chapter 15 Datatypes Variables in 3minutes
Chapter 15 Datatypes Variables in 3minutes
types in 3 minutes
SURESH TECHS
CHAPTER 15 C PROGRAMMING COURSE
Variables
• Variables are used to store the data
and it’s value can be changed at any
time
• Syntax:
• type variable
• type variable1, variable2
• Ex:
• int a;
• long int la;
• float b;
• char c;
Rules for defining Variables
• A variable can have alphabets, digits, and underscore.
• A variable name can start with the alphabet, and underscore only. It
can't start with a digit.
• No whitespace is allowed within the variable name.
• A variable name must not be a keyword
Types of Variables
• local variable
• global variable
• static variable
• automatic variable
• external variable
Will discuss in
storage classes chapter
Data types
Data types
• A data type defines the type of data and size of the data
Data types
Primary Secondary
Data types Data types
Alpha User
Numeric Derived
numeric defined
User Derived
Defined Data types
Structure
Array
Union String
Typedef Pointer
Enum Functions
int data type
• It holds integers(negative integers, zero and positive integers).
• The keyword "int" is used to declare the integer data type and the
format specifier is denoted by "%d".
• We can also use different type modifiers with this data type.
• The long keyword increases the memory allocated to the int data type. The
range increases accordingly.
• The signed keyword specifies that all positive, negative and zero integers
can be stored.
• Decimal numbers are those which contain an integer part and a fractional
part separated by a decimal point
• The key difference between the float and the double data type is the
number of digits each can store after the decimal point and
therefore the memory allocated to both of them is different.
• The double data type has 15 decimal digits of precision while the
float data type has 6 decimal digits of precision
char data type
• It is used to store single character values
• Each character has an ASCII value associated with it. The keyword
“char” is used to declare the char data type.
• The signed char data type has a range from -127 to 128.
User Derived
Defined Data types
Structure
Array
Union String
Typedef Pointer
Enum Functions
కొన్నన రోజులు (Research)
Father
3. Fight with king “SURBALI”
Dennis Ritchie