Data Types
The data type is the type of data that a given variable can store. Different data types have different sizes. There are 3 types of data types in C:
- Basic Data Types
- Derived Data Types
- User Defined Data Types
1. Basic Data Types
Basic data types are built-in in the C programming language and are independent of any other data type. There are x types of basic data types in C:
- char: Used to represent characters.
- int: Used to represent integral numbers.
- float: Used to represent decimal numbers up to 6-7 precision digits.
- double: Used to represent decimal numbers up to 15 precision digits.
- void: Used to represent the valueless entity.
Example of Basic Data Types
char c = 'a'; int integer = 24; float f = 24.32; double d = 24.3435; void v;
The size of these basic data types can be modified using data type modifiers which are:
- short
- long
- signed
- unsigned
Example of Data Type Modifiers
unsigned int var1; long double var2; long int var3;
2. Derived Data Types
Derived data types are derived from the basic data types. There are 2 derived data types in C:
- Arrays
- Pointers
3. User-Defined Data Types
The user-defined data types are the data types that are defined by the programmers in their code. There are 3 user-defined data types in C:
- Structure
- Union
- Enumeration
C Cheat Sheet
This C Cheat Sheet provides an overview of both basic and advanced concepts of the C language. Whether you’re a beginner or an experienced programmer, this cheat sheet will help you revise and quickly go through the core principles of the C language.
In this Cheat Sheet, we will delve into the basics of the C language, exploring its fundamental concepts that lay the groundwork for programming. We will cover topics such as variables, data types, and operators, providing you with a solid understanding of the building blocks of C programming.
Contact Us