What are data types in C?
a) Define the type of data a variable can hold
b) Functions
c) Storage classes
d) Preprocessor directives
Answer:
a) Define the type of data a variable can hold
Explanation:
Data types in C define the type and size of data that a variable can hold. Common data types in C include int
for integers, float
for floating-point numbers, char
for characters, and double
for double-precision floating-point numbers. Each data type has specific attributes, such as size in bytes and range of values it can represent.
Choosing the appropriate data type is crucial for efficient memory management and accurate representation of data. Understanding data types helps in writing precise and optimized code in C.