Thread: Character Arrays

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    3

    Character Arrays

    I am new here and I have a problem. It may have been discused in one of the 16911 other threads but I have limited time to search for it currently. My problem is that when I type the following I get an error:
    Code:
    int main
    {
        char bob[9];
        bob = "hello";
    }
    I have tried variations on this and the only thing that works is:

    Code:
    int main
    {
        char bob[9];
        bob[0] = 'h';
        bob[1] = 'e';
        bob[2] = 'l';
        bob[3] = 'l';
        bob[4] = 'o';
    }
    It may be that it is a Dev problem if so please tell me, I am getting tired of all the errors its causing when I forget
    Last edited by Smiley27; 04-12-2004 at 03:23 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. Character handling help
    By vandalay in forum C Programming
    Replies: 18
    Last Post: 03-29-2004, 05:32 PM
  4. Comparing Character Arrays problem...
    By newy100 in forum C++ Programming
    Replies: 4
    Last Post: 11-16-2003, 07:54 PM
  5. Spaces in Character Arrays
    By ADLOTS in forum C++ Programming
    Replies: 3
    Last Post: 11-25-2002, 04:24 AM