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 data structure

1 Answers   Accenture,


What is complete binary tree in data structure?

0 Answers  


Why do we need searching algorithms?

0 Answers  


What is data type and its types?

0 Answers  


What is dynamic array in excel?

0 Answers  






There are 2 int type array data type. One is containing 50 elements, and another one is containing 30 elements. Can we assign the array of 50 elements to an array of 30 elements?

0 Answers  


Suppose in an integer array, there is 1 to 100 number, out of one is duplicate, how to find?

0 Answers  


What is the Difference between treemap and hashmap?

0 Answers  


write a program to accept name & sort them?

0 Answers  


How do you sort an array by value?

0 Answers  


What is the difference between set and unordered_set?

0 Answers  


What is data structure definition?

0 Answers  


Categories