?
String handling functions such as strcmp(), strcpy() etc can be used with enumerated types.
Answer & Solution
Correct Answer:
Option
B
Enumerated types (enums) in C are used to give names to integer constants. For example:
This creates an
String handling functions like
You cannot directly use
Therefore, the statement "String handling functions such as strcmp(), strcpy() etc can be used with enumerated types" is False.
enum days {MON, TUE, WED, THU, FRI, SAT, SUN};This creates an
enum named days where MON is assigned 0, TUE is 1, and so on.String handling functions like
strcmp() and strcpy() work with strings, which are arrays of characters (char). They don't directly work with enum types.You cannot directly use
strcmp() to compare two enum values because strcmp() expects character arrays, not integer values that enums represent. Similarly, you cannot copy an enum value using strcpy().Therefore, the statement "String handling functions such as strcmp(), strcpy() etc can be used with enumerated types" is False.
Join the Discussion
Login to post a comment or share your explanation.
Login