Cannot compare pointers to strings?

by dE_logics
Tags: compare, pointers, strings
dE_logics is offline
Sep6-09, 10:14 PM
P: 730
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
Simplicity is key to co-operative robots
Chemical vapor deposition used to grow atomic layer materials on top of each other
Earliest ancestor of land herbivores discovered
Hurkyl is offline
Sep6-09, 10:46 PM
Sci Advisor
PF Gold
Hurkyl's Avatar
P: 16,101
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.
dE_logics is offline
Sep7-09, 12:25 AM
P: 730
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