"Mike Copeland" <mr*****@cox.netwrote in message
news:MP************************@news.cox.net...
How do I distinguish a pointer to a character variable versus a
pointer to a C-type character string? For example,
void Funct1(char *str) // "str" is a character string variable
void Funct2(char *chr) // "chr" is a single character variable
In both cases, I wish to modify the parameter argument, but it seems
to me they are really different data types.
Also, is there any way to _override_ the declaration of a function
with these 2 distinctive data types? Please advise. TIA
They actually aren't different types that is. A pointer doesn't care if it
points to one object, or a number of objects. One thing you could do for
yourself to help self document it a little is:
void Func1( char str[] ) // "str" is a character string variable
void Func2( char* chr ) // "chr" is a single character variable
But it really doesn't make a difference. Although I've never seen the []
format used for a single character. You can still pass the address of a
single character to Func1 or Func2, or an array.