Cannot compare pointers to strings?

  1. 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 (Text):
    char convert(unsigned char input[]);
    main()
    {
        unsigned char input[1000];
        convert(input);
    }
    char convert (unsigned char input[])
    {
        int i;
        if(input[0] == " ");
    }
     
  2. jcsd
  3. Hurkyl

    Hurkyl 16,090
    Staff Emeritus
    Science Advisor
    Gold Member

    input[0] has type unsigned char&.
    " " has type const char*.

    You meant ' ' which has type char.
     
  4. Oh...damn...I meant single quotes. :P
     
Know someone interested in this topic? Share a link to this question via email, Google+, Twitter, or Facebook