Data Types in C Language
The C language supports a wide variety of data types. These include:
- Primitive Data Types:
– Integer: char, int, short, long, long long
– Floating Point: float, double
– Boolean: _Bool
– Void
- Derived Data Types:
– Array: int array[10]
– Pointer: int *pointer
– Structure: struct student {…}
– Union: union data {…}
– Enumeration: enum color {…}
Data Types & Sizes
Data Type | Size (in bytes) | Description |
char | 1 | Character type, stores a single character or ASCII code |
int | 4 | Integer type, stores a whole number |
float | 4 | Floating-point type, stores a decimal number with single precision |
double | 8 | Floating-point type, stores a decimal number with double precision |
short | 2 | Short integer type, stores a smaller whole number than int |
long | 8 | Long integer type, stores a larger whole number than int |
long long | 8 | Long long integer type, stores an even larger whole number than long |
void | N/A | Void type, represents the absence of a value |
List Of Keywords of C Language
Keyword | Description |
auto | Defines a variable with automatic storage duration |
break | Terminates the current loop or switch statement |
case | Specifies a branch in a switch statement |
char | Declares a character data type |
const | Defines a variable as constant |
continue | Skips the current iteration of a loop |
default | Specifies the default branch in a switch statement |
do | Begins a do-while loop |
double | Declares a double-precision floating-point data type |
else | Specifies an alternative branch in an if statement |
enum | Declares an enumerated type |
extern | Declares a variable or function that is defined in another file |
float | Declares a floating-point data type |
for | Begins a for loop |
goto | Transfers control to a labeled statement |
if | Begins an if statement |
int | Declares an integer data type |
Keyword | Description |
long | Declares a long integer data type |
register | Defines a variable with register storage class |
return | Returns a value from a function |
short | Declares a short integer data type |
signed | Declares a signed data type |
sizeof | Returns the size of a data type or variable |
static | Defines a variable with static storage duration |
struct | Defines a structured data type |
switch | Begins a switch statement |
typedef | Defines a new data type |
union | Defines a union data type |
unsigned | Declares an unsigned data type |
void | Specifies that a function returns no value |
volatile | Declares a variable that can be modified by hardware or other processes |
while | Begins a while loop |