Which of the following is not true about structs in C?
a) Structs can have members of different data types
b) Structs can contain functions
c) Structs can be passed to functions
d) Structs can be nested
Answer:
b) Structs can contain functions
Explanation:
In C, structs are used to group variables of different data types together. However, unlike classes in C++, structs in C cannot contain functions. They are purely data structures that store related data. Structs can be nested (a struct within a struct), passed to functions, and can have members of various data types.
Understanding the limitations and capabilities of structs in C is essential for effectively organizing and managing complex data.