Thread Closed

Cannot compare pointers to strings?

 
Share Thread Thread Tools
Sep6-09, 10:14 PM   #1
 

Cannot compare pointers to strings?


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.

Code:
char convert(unsigned char input[]);
main()
{
	unsigned char input[1000];
	convert(input);
}
char convert (unsigned char input[])
{
	int i;
	if(input[0] == " ");
}
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Hong Kong launches first electric taxis
>> Morocco to harness the wind in energy hunt
>> Galaxy's Ring of Fire
Sep6-09, 10:46 PM   #2
 
Recognitions:
Gold Membership Gold Member
Science Advisor Science Advisor
Retired Staff Staff Emeritus
Quote by dE_logics View Post
Code:
if(input[0] == " ");
input[0] has type unsigned char&.
" " has type const char*.

You meant ' ' which has type char.
 
Sep7-09, 12:25 AM   #3
 
Oh...damn...I meant single quotes. :P
 
Thread Closed
Thread Tools


Similar Threads for: Cannot compare pointers to strings?
Thread Forum Replies
Converting open strings to closed strings Beyond the Standard Model 4
pointers not allowed to used iostream Programming & Comp Sci 4
Coding a Bubble Sort routine using a pointer array Programming & Comp Sci 4
New and looking for pointers. General Discussion 0
Siemens fc10 to compare 2 strings Electrical Engineering 1