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

What is a directed graph?

0 Answers  


Can we apply binary search algorithm to a sorted linked list, why?

0 Answers  


What is stack and its operations?

0 Answers  


What is the best case time complexity of bubble sort?

0 Answers  


Is quicksort a stable algorithm?

0 Answers  






How memory is reserved using a declaration statement ?

0 Answers  


Write an algorithm to show the reverse of link list?

0 Answers  


What is bubble sort technique?

0 Answers  


Does linked list allow null values?

0 Answers  


In what scenario, binary search can be used?

0 Answers  


What is the difference between list, set and map?

0 Answers  


How do you do binary search?

0 Answers  


Categories