Class functions and pointers

Hi,
I need help in understanding about passing pointer values to a class function...

1
2
3
4
5
6
7
8
int Hex(char *Str); // function
....
...
...
char* hexaD;
cout<<"Enter the Hexadecimal Number:"<<endl;
cin>>hexaD;
obj.Hex(hexaD);


And it's even complicated with a pointer function...
 
char *Hex(int Num); 


Please guide me.

Thanks in advance.
Pointers are like a kind of variable which when dereferenced points to the address it's been assigned, it may also have an address value of NULL, meaning it's not currently pointing to anything.

References are like creating another variable as an alias to accessing the object, without needing to be dereferenced.

But what you're after is not pointer related, you're dealing with C strings known as string literals. The variable hexaD is able to contain an array of characters. So in essence you're passing a string to the Hex function.
Oh, okay.
then in this case, the parameter passed is it correct?
And suppose have to convert it to lower or upper case how do I use the variable hexaD as?
I'm guessing this is homework with guidelines in place, perhaps the intended method you need to do is to undertake this manually.

Assuming this is the case, use this as reference: http://www.cplusplus.com/reference/cstring/

Loop through up to strlen(), and assign each character using tolower() or toupper().

It's your homework, things need to be explored on your own. Unfortunately that's the best and only way to learn how to program.
I wasn't sure about this topic, before I posted here.

Thanks for the help. :)
Topic archived. No new replies allowed.