0% found this document useful (0 votes)
14 views

Data Types 3rd Lesson

Uploaded by

omerabubaker13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Data Types 3rd Lesson

Uploaded by

omerabubaker13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

In C programming, variables are stored in different data types based on the kind of

data they hold. Here’s a list of commonly used data types in C:

1. Basic Data Types


int: Used for integers (whole numbers).
Example: int age = 25;
float: Used for single-precision floating-point numbers (decimal numbers with up to
7 digits of precision).
Example: float price = 19.99;
double: Used for double-precision floating-point numbers (more precise than float
with up to 15-16 digits of precision).
Example: double pi = 3.1415926535;
char: Used for single characters (stores a single character in 1 byte).
Example: char grade = 'A';

2. Modified Data Types


short int (short): A shorter version of int (less memory).
Example: short int smallNumber = 32767;
long int (long): A longer version of int (more memory for larger integers).
Example: long int largeNumber = 100000L;
long long int (long long): Even larger integer type, providing the highest capacity
for integers.
Example: long long int veryLargeNumber = 9223372036854775807LL;
unsigned variants: Use unsigned with int, char, long, etc., to store only non-
negative values (doubles the positive range).
Example: unsigned int uAge = 30;
3. Derived Data Types
array: A collection of elements of the same data type.
Example: int numbers[5] = {1, 2, 3, 4, 5};
pointer: A variable that stores the memory address of another variable.
Example: int *ptr = &age;
structure (struct): Used to group different data types together.

You might also like