size of extern variable

Discussion in 'C Programming' started by theshubham, Sep 10, 2012.

  1. theshubham

    theshubham

    Joined:
    Sep 10, 2012
    Messages:
    2
    Likes Received:
    0
    main()
    {
    extern int i;
    i=20;
    printf("%d", sizeof(i));
    }


    It gives Error ... why ???
    and if i remove i=20; statement the answer is 2.


    why so ??
     
    theshubham, Sep 10, 2012
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Matthews
    Replies:
    5
    Views:
    3,191
    tom_usenet
    Aug 2, 2004
  2. Dan Elliott
    Replies:
    4
    Views:
    13,600
    Tom Widmer
    Dec 8, 2004
  3. Dr. Colombes
    Replies:
    1
    Views:
    1,273
    John Hunter
    Feb 10, 2005
  4. skishorev@yahoo.co.in

    Size of extern int x;

    skishorev@yahoo.co.in, May 16, 2006, in forum: C Programming
    Replies:
    6
    Views:
    434
    Barry Schwarz
    May 21, 2006
  5. joshc
    Replies:
    9
    Views:
    791
    lawrence.jones@ugs.com
    Aug 1, 2006
  6. manoj.pattanaik@gmail.com
    Replies:
    3
    Views:
    709
    Fei Liu
    Apr 21, 2006
  7. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    13,474
    Michael Jung
    May 25, 2008
  8. Andre
    Replies:
    5
    Views:
    819
    Keith Thompson
    Jul 17, 2012
Loading...