Thread: size of array

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    size of array

    Hi guys, why can't I write in c like this int arr[4.5] ?

  2. #2
    Registered User
    Join Date
    Dec 2018
    Posts
    38
    Is this a serious question?

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    What does your compiler tell you?

  4. #4
    Registered User Kernelpanic's Avatar
    Join Date
    Sep 2018
    Location
    Berlin
    Posts
    105
    The compiler tells: Take still a joint!

    Joint music:
    YouTube

  5. #5
    Registered User
    Join Date
    May 2012
    Location
    Arizona, USA
    Posts
    948
    Does it make sense to have half of an element? What would that even mean?

    Assuming int is 32 bits wide, do you expect the compiler to make the last element 16 bits wide? What if you try "int arr[4.3]"? Would you expect the compiler to give you a last element that's 9.6 bits wide??

    Try to think these things through before asking questions that should be pretty obviously silly.

  6. #6
    Banned
    Join Date
    Apr 2015
    Posts
    596
    thanks ! convinced me

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to add my array size of 9 x 9 in it. THANKS!
    By Xian Yao in forum C Programming
    Replies: 8
    Last Post: 10-18-2013, 05:38 AM
  2. size of an array poited by array element
    By mitofik in forum C Programming
    Replies: 7
    Last Post: 12-24-2010, 12:09 AM
  3. How do I get the size of an array from a pointer to the array?
    By Programmer_P in forum C++ Programming
    Replies: 31
    Last Post: 06-03-2010, 04:13 PM
  4. size of array - why function gives size ONE only
    By noob123 in forum C++ Programming
    Replies: 7
    Last Post: 12-18-2009, 05:20 PM
  5. Finding Words in a array[size][size]
    By ^DJ_Link^ in forum C Programming
    Replies: 8
    Last Post: 03-08-2006, 03:51 PM

Tags for this Thread