Register to reply

Cannot compare pointers to strings?

by dE_logics
Tags: compare, pointers, strings
Share this thread:
Sep6-09, 10:14 PM
P: 735
After compiling the code below, GCC says that you can't compare a pointer to string by iso C++ standards.

But I don't see a pointer anywhere (I don't know pointers for now...did it long ago, now forgot)...may be it has to do with the fact that arrays are called by reference.

char convert(unsigned char input[]);
	unsigned char input[1000];
char convert (unsigned char input[])
	int i;
	if(input[0] == " ");
Phys.Org News Partner Science news on
Scientists discover RNA modifications in some unexpected places
Scientists discover tropical tree microbiome in Panama
'Squid skin' metamaterials project yields vivid color display
Sep6-09, 10:46 PM
Sci Advisor
PF Gold
Hurkyl's Avatar
P: 16,091
Quote Quote by dE_logics View Post
if(input[0] == " ");
input[0] has type unsigned char&.
" " has type const char*.

You meant ' ' which has type char.
Sep7-09, 12:25 AM
P: 735
Oh...damn...I meant single quotes. :P

Register to reply

Related Discussions
Converting open strings to closed strings Beyond the Standard Model 4
Pointers not allowed to used iostream Programming & Computer Science 4
Coding a Bubble Sort routine using a pointer array Programming & Computer Science 4
New and looking for pointers. General Discussion 0
Siemens fc10 to compare 2 strings Electrical Engineering 1