0 like 0 dislike
in Biology by (1m points)
What is the use of data type in C. Explain different types used in C language

1 Answer

0 like 0 dislike
by (1m points)
A data type determines the type and the operations that can be performed on the data. C++ provides various data types and each data type is represented differently within the computer's memory. The various data types provided by C++ are built-in data types, derived data types and user-defined data types as shown in Figure.

Built-In Data Types

 The basic (fundamental) data types provided by c++ are integral, floating point and void data type. Among these data types, the integral and floating-point data types can be preceded by several type modifiers. These modifiers (also known as type qualifiers) are the keywords that alter either size or range or both of the data types. The various modifiers are short, long, signed and unsigned. By default the modifier is signed.

In addition to these basic data types, ANSI C++ has introduced two more data types namely, bool and wchar_t.

Integral Data Type: The integral data type is used to store integers and includes char (character) and int (integer) data types.

Char: Characters refer to the alphabet, numbers and other characters (such as {, @, #, etc.) defined in the ASCII character set. In C++, the char data type is also treated as an integer data type as the characters are internally stored as integers that range in value from -128 to 127. The char data type occupies 1 byte of memory (that is, it holds only one character at a time).

The modifiers that can precede char are signed and unsigned. The various character data types with their size an range are listed in Table

Int: Numbers without the fractional part represent integer data. In C++, the int data type is used to store integers such as 4, 42, 5233, -32, -745. Thus, it cannot store numbers such as 4.28, -62.533. The various integer data types with their size and range are listed in Table
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers


3.2k users

Free Hit Counters