C - Data Types

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Pointers to void (void Type)

A pointer of type void * represents the address of an object, but not its type. For example a memory allocation function void *malloc( size_t size ); returns a pointer to void which can be casted to any data type.

Basic Types: (Types and Description)

Basic Types: They are arithmetic types and consists of the two types: (a) integer types and (b) floating-point types.

int (Integer Types)

Storage size: Value range: -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647

signed char (Integer Types)

Storage size: 1 byte Value range: -128 to 127

unsigned char (Integer Types)

Storage size: 1 byte Value range: 0 to 255

long double (Floating-Point Types)

Storage size: 10 byte Value range:3.4E-4932 to 1.1E+4932 Precision:19 decimal places

short (Integer Types)

Storage size: 2 bytes Value range: -32,768 to 32,767

unsigned short (Integer Types)

Storage size: 2 bytes Value range: 0 to 65,535

long (Integer Types)

Storage size: 4 byte Value range: -2,147,483,648 to 2,147,483,647

unsigned long (Integer Types)

Storage size: 4 byte Value range: 0 to 4,294,967,295

Flot (Floating-Point Types)

Storage size: 4 byte Value range: 1.2E-38 to 3.4E+38 Precision:6 decimal places

double (Floating-Point Types)

Storage size: 8 byte Value range: 2.3E-308 to 1.7E+308 Precision:15 decimal places

char (Integer Types)

Storage size:1 byte Value range: 128 to 127 or 0 to 255

unsigned int (Integer Types)

Storage size:2 or 4 bytes Value range: 0 to 65,535 or 0 to 4,294,967,295

Types and Description

The array types and structure types are referred to collectively as the aggregate types. The type of a function specifies the type of the function's return value. We will see basic types in the following section, whereas, other types will be covered in the upcoming chapters.

Floating-Point Types

The header file float.h defines macros that allow you to use these values and other details about the binary representation of real numbers in your programs. Following example will print storage space taken by a float type and its range values:

The type void:(Types and Description)

The type specifier void indicates that no value is available.

Function arguments as void (void Type)

There are various functions in C which do not accept any parameter. A function with no parameter can accept as a void. For example, int rand(void);

Function returns as void (void Type)

There are various functions in C which do not return value or you can say they return void. A function with no return value has the return type as void. For example void exit (int status);

Enumerated types:(Types and Description)

They are again arithmetic types and they are used to define variables that can only be assigned certain discrete integer values throughout the program.

Derived types:(Types and Description)

They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types.

The expressions sizeof(type) (sizeof operator)

To get the exact size of a type or a variable on a particular platform, This expressions yields the storage size of the object or type in bytes. Following is an example to get the size of int type on any machine

The header file float.h defines

macros that allow you to use these values and other details about the binary representation of real numbers in your programs. Following example will print storage space taken by a float type and its range values:

data types

refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.


संबंधित स्टडी सेट्स

ch 8 health laws and regulations quiz

View Set

Weekly Challenge 2 - Google Project Management

View Set

BUS STATS: CH 5 - Discrete Probability

View Set

Federal Tax COnsiderations for Life Insurance

View Set

Chapter 10,11,12 Child Development

View Set