Thread: incompatible types huh??

  1. #1
    Registered User
    Join Date
    Mar 2002

    incompatible types huh??

    I'm getting a compiler error and was hoping someone could help me out. This is what I'm trying:

    char identity[7];

    string id = ("id") // from the form, this is a CGI program

    identity = id.c_str(); // want to make this a char array so I can use strstr().

    It gives an error saying incompatible types in assignment of 'const char * to char[7]'.

    Anybody know what I should do. As far as I know it should work.

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    You can't use the equal sign to give it a value. Instead, use strcpy or something like that.

  3. #3
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Or just use a pointer instead of an array.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Incompatible types in assignment.
    By killpoppop in forum C Programming
    Replies: 36
    Last Post: 12-22-2008, 12:08 PM
  2. incompatible pointer types
    By quasigreat in forum C Programming
    Replies: 4
    Last Post: 05-22-2008, 12:30 AM
  3. line 10: incompatible types in initializer
    By veronica_22pf in forum C Programming
    Replies: 4
    Last Post: 01-13-2008, 04:44 PM
  4. The Interactive Animation - my first released C program
    By ulillillia in forum A Brief History of
    Replies: 48
    Last Post: 05-10-2007, 02:25 AM
  5. incompatible pointer types
    By mart_man00 in forum C Programming
    Replies: 3
    Last Post: 04-20-2003, 08:32 PM