0 votes
in Computer by (45.8k points)
closed by

Define different data types used in ‘C’ language.

1 Answer

+1 vote
by (45.4k points)
selected by
Best answer

Data Types in ‘C’ Language: In ‘C’ language, the foil- owing Data Types are used:

1. Numeric data type

2. Alphanumeric data type

3. Date and time data type

4. Logical data type.

1. Numeric data type: Numbers of any type constitute numeric data. The numeric data can contain only the numeric characters of 0 to 9, with or without the decimal point. Some important numeric data types are int, float and double types.

Type int: The data type, which stores numeric data, is one of the basic data types in any programming language. It contains a sequence of one or more digits. For example —int sum. The variable ‘sum’ can store an integer value. It stores non-fractional values and occupies 2 bytes.

Type float: The float data type can be used for storing values containing decimal places. The difference between int and float is only that the int type includes only whole numbers but the float type includes both whole as well as fractional numbers. It occupies 4 bytes.

Type double: The type double is used, when the accuracy obtained using the variable of the type float is not sufficient. Variables of the type double can store twice the number of digits as can a float type. It occupies 8 bytes. The type float saves memory as it takes only half as much space as a double.

2. Alphanumeric data type: This data type can be made up of any type of characters. Numeric = 0 to 9

Alphabetic = A to Z and a to z

Special Characters = #, $, * , etc.

These types of characters are generally enclosed within quotes “122” is considered alphanumeric data. On alphanumeric data mathematical calculations cannot be performed. For example: Char can store a single character e.g., char A = ‘X’ char A[5] = “HARSH” A char type can also store a collection of characters known as a string.

3. Date and Time data type: These are special data types for date and time values. Date: It is a single data type that handles both date and time values. Time: It can handle date and time values separately.

4. Logical data type: Logical data can have only two values le., true and false. A single data type handles logical data. It is represented by Boolean data type.

No related questions found

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.