sizeof rows (not columns)

This is a discussion on sizeof rows (not columns) within the C Programming forums, part of the General Programming Boards category; Is it possible for sizeof to give me the number of rows in my array rather than columns. char list[7][70]; ...

  1. #1
    Unregistered
    Guest

    Unhappy sizeof rows (not columns)

    Is it possible for sizeof to give me the number of rows in my array rather than columns.


    char list[7][70];

    int main()
    {
    printf("%d",sizeof(list); /* produces 490 (7*70) */


    printf("%d",sizeof(list[0])); /* produces 70 */
    }


    I want to produce the number of rows i.e. 7

    thx for the help all.

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    ...
    Code:
    (sizeof (list)) / (sizeof (list [0]))

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 02:03 AM
  2. Addition of the rows and columns in an array.
    By Turtal in forum C Programming
    Replies: 4
    Last Post: 11-14-2006, 09:00 PM
  3. Replies: 14
    Last Post: 06-28-2006, 02:58 AM
  4. sum rows & columns in array
    By ronenk in forum C Programming
    Replies: 7
    Last Post: 06-20-2004, 05:16 AM
  5. calculation from rows and columns
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 07-08-2002, 08:44 PM

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