Fred
2011-04-18 04:34:06 UTC
So basically, I have a char pointer to a number.
e.g. char *num = '12345'
Now, I want to pass num (the adress of num[0]) to a function, except that I want it to be recognised as an int and I want to use pass by reference.
e.g.
void somefunc (int &number)
{
// Do stuff.
}
int main()
{
char *num = '12345';
somefunc (*num)
}
Basically, I reckon that there should be a way to point to an adress, and interpret what is at the location pointed to, as an integer.
Anyone know if, and how this can be done?
Thanks.
PS Is the way to do this simply using a void pointer?