size of extern variable

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

  1. theshubham

    theshubham

    Joined:
    Sep 10, 2012
    Messages:
    2
    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. Advertising

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:
    2,413
    tom_usenet
    Aug 2, 2004
  2. skishorev@yahoo.co.in

    Size of extern int x;

    skishorev@yahoo.co.in, May 16, 2006, in forum: C Programming
    Replies:
    6
    Views:
    339
    Barry Schwarz
    May 21, 2006
  3. joshc
    Replies:
    9
    Views:
    599
    lawrence.jones@ugs.com
    Aug 1, 2006
  4. manoj.pattanaik@gmail.com
    Replies:
    3
    Views:
    482
    Fei Liu
    Apr 21, 2006
  5. Andre
    Replies:
    5
    Views:
    535
    Keith Thompson
    Jul 17, 2012
Loading...

Share This Page