Thread: sizeof rows (not columns)

  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, 01: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, 01:58 AM
  4. sum rows & columns in array
    By ronenk in forum C Programming
    Replies: 7
    Last Post: 06-20-2004, 04:16 AM
  5. calculation from rows and columns
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 07-08-2002, 07:44 PM