how does typedef work in this question ???

This is a discussion on how does typedef work in this question ??? within the C Programming forums, part of the General Programming Boards category; Code: typedef int c[12]; c name={1,2,3,4}; cout<<name[0]; how does the above code work ??...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    17

    how does typedef work in this question ???

    Code:
    typedef int c[12];
    c name={1,2,3,4};
    cout<<name[0];
    how does the above code work ??

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,528
    The 2nd line reads like:

    Code:
    int name[12] = {1,2,3,4};
    The rest of the places remain uninitialized.

    btw.... Though it doesn't matter here, you should post threads having C++ code in the C++ page.
    Manasij Mukherjee | gcc-4.9.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-23-2011, 10:00 AM
  2. question about typedef
    By rob90 in forum C Programming
    Replies: 3
    Last Post: 12-14-2009, 06:01 AM
  3. Program on typedef - work around
    By thelink123 in forum C Programming
    Replies: 3
    Last Post: 07-24-2009, 04:56 AM
  4. Question regarding typedef
    By esmeco in forum C Programming
    Replies: 2
    Last Post: 04-24-2008, 12:58 PM
  5. typedef question
    By Chaplin27 in forum C++ Programming
    Replies: 4
    Last Post: 09-22-2006, 11:42 AM

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