Thread: array confusion (int vs char)

  1. #1
    Registered User
    Join Date
    Feb 2012
    Location
    Trinidad & Tobago
    Posts
    43

    array confusion (int vs char)

    i was reading a text which stated an integer array for e.g
    Code:
    int array[5];
    can store 5 elements where ,as character array
    Code:
    char array[5]={"abcd"}
    can store 4 elements

    is this true ?
    can someone please clarify this for me
    thank u.

  2. #2
    Registered User camel-man's Avatar
    Join Date
    Jan 2011
    Location
    Under the moon
    Posts
    693
    It actually stores 5 characters, one being the null terminating character '\0'

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Confusion with fread from .txt array in C
    By dm14v07 in forum C Programming
    Replies: 2
    Last Post: 05-02-2011, 07:32 PM
  2. Replies: 3
    Last Post: 11-17-2008, 12:36 PM
  3. char variable[#] - confusion
    By Chris2222 in forum C Programming
    Replies: 8
    Last Post: 09-27-2007, 11:53 PM
  4. char confusion
    By noodles in forum C Programming
    Replies: 6
    Last Post: 06-24-2006, 11:32 AM
  5. array and char confusion
    By hanhao in forum C++ Programming
    Replies: 1
    Last Post: 03-13-2004, 05:59 AM