C99 feature

This is a discussion on C99 feature within the C Programming forums, part of the General Programming Boards category; Whats the difference between the 2 following prototypes? Code: void VIDE_do_anim_lists(size_t n, struct DATA_LIST *Lists[n]); void VIDE_do_anim_lists(size_t n, struct DATA_LIST ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    330

    C99 feature

    Whats the difference between the 2 following prototypes?


    Code:
    void VIDE_do_anim_lists(size_t n, struct DATA_LIST *Lists[n]);
    
    void VIDE_do_anim_lists(size_t n, struct DATA_LIST *Lists[]);

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The former, which is only allowed in C99, is indicating the size of the array being passed in. It does not in any way GUARANTEE this size - but it indicates that the size is the same as n.

    The latter form, obviously, does not indicate anything about the size of the array.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c99
    By Nextstopearth in forum C Programming
    Replies: 8
    Last Post: 02-20-2009, 10:58 PM
  2. C89 or C99
    By talin in forum C Programming
    Replies: 6
    Last Post: 05-26-2008, 12:45 PM
  3. C99 and int main()
    By cwr in forum C Programming
    Replies: 8
    Last Post: 09-19-2005, 06:54 AM
  4. C99 support?
    By Devil Panther in forum C Programming
    Replies: 3
    Last Post: 08-22-2005, 02:07 PM
  5. My first game
    By homeyg in forum Game Programming
    Replies: 20
    Last Post: 12-22-2004, 04:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21