Why enum can not be used directly with printf function?

Answers were Sorted based on User's Feedback



Why enum can not be used directly with printf function?..

Answer / rashmi p

enum is not an basic data type like int,float and all it is
a user defined data type, and printf function works only
with basic data type, we 've overload printf function to
make it work for user defined data types :)

Is This Answer Correct ?    21 Yes 2 No

Why enum can not be used directly with printf function?..

Answer / sudip

main()
{
enum color{
red,black,green,yellow,blue,pink,white
};
printf("%d",green);
printf("%d",yellow);
}

this gives me output.... 23
we can use it....?/ Correct me if I am wrong...

Is This Answer Correct ?    8 Yes 0 No

Why enum can not be used directly with printf function?..

Answer / srinivas

it is DAta type name like int so it can not be in printf

Is This Answer Correct ?    5 Yes 3 No

Post New Answer

More Data Structures Interview Questions

Explain the Queue

1 Answers   Tech Mahindra,


What is Another name of Dynamically allocating memory.

1 Answers  


ple.. briefly describe the purpose of having a base case and a recursive case in a recursive algorithm

2 Answers  


Why do we use hashset?

1 Answers  


How do you insert a new item in a binary search tree?

1 Answers  


Why is hashmap faster?

1 Answers  


What are the advantages of merge sort?

1 Answers  


In depth questions regarding the data structures and the Databases used in the Projects developed.

1 Answers   Motorola,


Can tuple be sorted?

1 Answers  


What do you mean by the term “percolate down”?

1 Answers  


What are the benefits of using arrays?

1 Answers  


Name some applications which use linked lists.

1 Answers  


Categories