simple

This is a discussion on simple within the C Programming forums, part of the General Programming Boards category; Code: void Code: main() { extern char a[30]; } How much array a is reserving memory space? how?...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    32

    simple

    Code:
    void
    Code:
     main()
    {
    extern char a[30];
    }

    How much array a is reserving memory space? how?

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,675
    Why to use extern?
    What is extern?

    Also the void is not clear why you wrote it... I do not believe that you wanted to write
    Code:
    void main()
    because the right thing is
    Code:
    int main(void)
    and you want to do the right thing

    As for the array, when we declare
    Code:
    char a[30]
    we create space for 30 characters
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  3. #3
    Registered User
    Join Date
    Jun 2012
    Location
    Here
    Posts
    23
    Quote Originally Posted by amzc View Post
    How much array a is reserving memory space? how?
    Since char takes only one byte, a[30] reserves exactly 30 bytes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Socket Library Not so simple
    By jbully in forum C Programming
    Replies: 4
    Last Post: 12-23-2010, 08:23 AM
  2. simple program, simple error? HELP!
    By colonelhogan44 in forum C Programming
    Replies: 4
    Last Post: 03-21-2009, 11:21 AM
  3. Simple program...simple problem?
    By deadherorising in forum C Programming
    Replies: 2
    Last Post: 03-12-2009, 08:37 PM
  4. Simple program, not so simple problem
    By nolsen in forum C++ Programming
    Replies: 2
    Last Post: 01-18-2008, 09:28 AM
  5. Replies: 1
    Last Post: 07-20-2002, 06:33 PM

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