Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

what is the datatype that accept both character and a number in c

–1 vote
asked May 24, 2018 by Preethi Priya (120 points)

2 Answers

0 votes
answered May 25, 2018 by anonymous
C type 'char' is an integer type interpreted as a character by some character mapping.

So you can store small integers in it. Then use it as an integer or a char.

https://onlinegdb.com/Hk-xMnrJQ

But it is not very clean, so you'd prefer to define a union that will store either a char or an int.
0 votes
answered May 31, 2018 by anonymous
char is the answer
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...