Variable with multiple data types

Hello All.
So guys i am making a program for my assignment.
Now in the code i want to use a variable which is a multiple data type variable.
What i mean to say here is that i want to use a variable which can take an int or char both.

I want to take input from the user. He can enter both the values int type or char type.

as an a variable "data" can be of both the int or char type. It can take a number or it can take a char as well.
Please Help :)
uhm why? Cant you use just two variables? You probably want just two variables instead.

Actually i am making a link list. The thing is that if i use two variables i.e
Pointer->int = 0
Pointer->Char = 'X'

Now the user can only enter the Number or the char.
If he enters int the char will be garbage or if he enters the char the int portion will b garbage

the struct for LL is like this

struct node
{
int data;
node *next;
};
Topic archived. No new replies allowed.