Void Main?

Discussion in 'C Programming' started by Wang Yip, Dec 24, 2009.

  1. Wang Yip

    Wang Yip Guest

    Hello I read Main shall not return Void but I always use and always
    work.... who is right
     
    Wang Yip, Dec 24, 2009
    #1
    1. Advertising

  2. Wang Yip

    Eric Sosman Guest

    On 12/24/2009 10:15 AM, Wang Yip wrote:
    > Hello I read Main shall not return Void but I always use and always
    > work.... who is right


    The function named Main() can return anything you like.
    Anything, or nothing. No restrictions: Do what you will,
    even to the extent of returning a value of type Void (which
    you can #define or typedef as you please).

    In a hosted implementation, the function named main()
    and having external linkage must be defined as returning an
    int value, and must actually return one if it returns at all.
    Under C99 rules, "falling off the end" of this function returns
    the int value zero; under earlier versions of the Standard the
    return had to be explicit.

    ... and this topic has been BEATEN TO DEATH so many times
    that I cannot imagine anyone wanting to go through it yet again.

    --
    Eric Sosman
    lid
     
    Eric Sosman, Dec 24, 2009
    #2
    1. Advertising

  3. Wang Yip

    Tim Prince Guest

    superpollo wrote:
    > Wang Yip ha scritto:
    >> Hello I read Main shall not return Void but I always use and always
    >> work.... who is right

    >
    > maybe some compilers are more forgiving than others ?
    >

    Many compilers have options to turn off standards checking (or skip it
    by default), which may be OK if you don't intend your run-time
    environment to see the success/failure return value.
     
    Tim Prince, Dec 24, 2009
    #3
  4. Wang Yip

    Rich Webb Guest

    On Thu, 24 Dec 2009 10:39:12 -0500, Eric Sosman
    <> wrote:

    >On 12/24/2009 10:15 AM, Wang Yip wrote:
    >> Hello I read Main shall not return Void but I always use and always
    >> work.... who is right

    >
    > The function named Main() can return anything you like.
    >Anything, or nothing. No restrictions: Do what you will,
    >even to the extent of returning a value of type Void (which
    >you can #define or typedef as you please).
    >
    > In a hosted implementation, the function named main()
    >and having external linkage must be defined as returning an
    >int value, and must actually return one if it returns at all.
    >Under C99 rules, "falling off the end" of this function returns
    >the int value zero; under earlier versions of the Standard the
    >return had to be explicit.
    >
    > ... and this topic has been BEATEN TO DEATH so many times
    >that I cannot imagine anyone wanting to go through it yet again.


    'Cause it's a quiet day otherwise? ;-)

    --
    Rich Webb Norfolk, VA
     
    Rich Webb, Dec 24, 2009
    #4
  5. Eric Sosman <> writes:
    > On 12/24/2009 10:15 AM, Wang Yip wrote:
    >> Hello I read Main shall not return Void but I always use and always
    >> work.... who is right

    >
    > The function named Main() can return anything you like.
    > Anything, or nothing. No restrictions: Do what you will,
    > even to the extent of returning a value of type Void (which
    > you can #define or typedef as you please).


    In case you misseed it, Eric's point is that C is case-sensitive;
    "Main" and "main" are two distinct and unrelated identifiers.

    > In a hosted implementation, the function named main()
    > and having external linkage must be defined as returning an
    > int value, and must actually return one if it returns at all.
    > Under C99 rules, "falling off the end" of this function returns
    > the int value zero; under earlier versions of the Standard the
    > return had to be explicit.


    And if you incorrectly declare main as "void main(void)", your
    program's behavior is undefined. It's an error that your compiler
    isn't required to diagnose. So if your compiler quietly accepts it
    and your program appears to work, that doesn't mean either that you
    got it right or that your compiler got it wrong. It's entirely *your*
    responsibility to get this right.

    The valid declarations for main are:
    int main(void)
    int main(int argc, char *argv[])
    The latter is equivalent to
    int main(int argc, char **argv)

    The comp.lang.c FAQ is at <http://www.c-faq.com/>. Read it.

    > ... and this topic has been BEATEN TO DEATH so many times
    > that I cannot imagine anyone wanting to go through it yet again.


    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Dec 24, 2009
    #5
  6. Wang Yip

    Kaz Kylheku Guest

    On 2009-12-24, Wang Yip <> wrote:
    > Hello I read Main shall not return Void but I always use and always
    > work.... who is right


    Of what value is your ``always''?

    How different are your uses from each other?

    If you use ``viod main'' in five hundred different programs, and it
    always works, but they all use the same compiler, run-time library
    and operating system, don't you think that these 500 programs
    are really just one test case? Don't you think that these 500 programs
    demonstrate only a /single/ data point: that void main works with
    that compiler and run-time environment?

    It's a big jump from a single data point to ``always''.

    Consider this: C has a static type system. Functions have a type.
    The function int X(int) is not compatible with void Y(int) .

    If you were writing a device driver at an embedded company, and one
    of the functions is declared as a pointer:

    int (*transmit)(netdev *dev, netpacket *);

    would you implement it like this:

    void my_transmit(netdev *dev, netpacket *);

    ?

    Your compiler would tell you that the address of my_transmit
    is not assignment-compatible to the transmit function pointer:

    static netdev dev = { ..., my_transmit, ...}; /* error */

    Suppose it's only a warning, and it compiles anyway. When the OS calls
    the driver's my_transmit, what do you think happens when the function
    returns? The caller expects a return value, but the function is void.

    Can you point the newsgroup to the chapter of some document
    which defines what happens in that situation?

    What makes you think you can just pick a random function type out of the
    air and use that for your main function?
     
    Kaz Kylheku, Dec 24, 2009
    #6
  7. Wang Yip

    Wang Yip Guest

    Thanks for reply. I tried search for Google groups before ask here but
    didn't find any answers.......


    On 24/12/2009 15:39, Eric Sosman wrote:
    > On 12/24/2009 10:15 AM, Wang Yip wrote:
    >
    >> Hello I read Main shall not return Void but I always use and always
    >> work.... who is right

    >
    >
    > The function named Main() can return anything you like.
    > Anything, or nothing. No restrictions: Do what you will,
    > even to the extent of returning a value of type Void (which
    > you can #define or typedef as you please).
    >
    > In a hosted implementation, the function named main()
    > and having external linkage must be defined as returning an
    > int value, and must actually return one if it returns at all.
    > Under C99 rules, "falling off the end" of this function returns
    > the int value zero; under earlier versions of the Standard the
    > return had to be explicit.
    >
    > ... and this topic has been BEATEN TO DEATH so many times
    > that I cannot imagine anyone wanting to go through it yet again.
    >
     
    Wang Yip, Dec 24, 2009
    #7
  8. Keith Thompson wrote:

    > Eric Sosman <> writes:
    >> On 12/24/2009 10:15 AM, Wang Yip wrote:
    >>> Hello I read Main shall not return Void but I always use and always
    >>> work.... who is right

    >>
    >> The function named Main() can return anything you like.
    >> Anything, or nothing. No restrictions: Do what you will,
    >> even to the extent of returning a value of type Void (which
    >> you can #define or typedef as you please).

    >
    > In case you misseed it, Eric's point is that C is case-sensitive;
    > "Main" and "main" are two distinct and unrelated identifiers.
    >
    >> In a hosted implementation, the function named main()
    >> and having external linkage must be defined as returning an
    >> int value, and must actually return one if it returns at all.
    >> Under C99 rules, "falling off the end" of this function returns
    >> the int value zero; under earlier versions of the Standard the
    >> return had to be explicit.

    >
    > And if you incorrectly declare main as "void main(void)", your
    > program's behavior is undefined. It's an error that your compiler
    > isn't required to diagnose. So if your compiler quietly accepts it
    > and your program appears to work, that doesn't mean either that you
    > got it right or that your compiler got it wrong. It's entirely *your*
    > responsibility to get this right.
    >


    I was in the impression that the C99 Standard allows implementations to
    provide additional return types. If an implementation supports "void", then
    behavior is not undefined. This is what i infer out of the "It shall be
    defined with return type of int ... or in some other implementation-defined
    manner."

    If, however, the implementation does not allow it, behavior is undefined. Is
    my interpretation wrong?
     
    Johannes Schaub (litb), Dec 24, 2009
    #8
  9. "Johannes Schaub (litb)" <> writes:
    > Keith Thompson wrote:

    [...]
    >> And if you incorrectly declare main as "void main(void)", your
    >> program's behavior is undefined. It's an error that your compiler
    >> isn't required to diagnose. So if your compiler quietly accepts it
    >> and your program appears to work, that doesn't mean either that you
    >> got it right or that your compiler got it wrong. It's entirely *your*
    >> responsibility to get this right.

    >
    > I was in the impression that the C99 Standard allows implementations to
    > provide additional return types. If an implementation supports "void", then
    > behavior is not undefined. This is what i infer out of the "It shall be
    > defined with return type of int ... or in some other implementation-defined
    > manner."
    >
    > If, however, the implementation does not allow it, behavior is undefined. Is
    > my interpretation wrong?


    You're right. I left that out in the vain hope of avoiding yet
    another lengthy discussion.

    Yes, an implementation may permit other declarations for main,
    including "void main(void)". If a given implementation permits that
    declaration (and documents it), then such a program's behavior is
    well defined *for that implementation*.

    There is no good reason for an implementation to permit "void
    main(void)", and no good reason for a programmer to take advantage
    of it. "int main(void)" works everywhere.

    One quibble: on freestanding implementations (roughly speaking,
    embedded systems), "void main(void)" might be perfectly sensible.
    But most beginners don't use such implementations.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Dec 24, 2009
    #9
  10. Wang Yip

    Wang Yip Guest

    Hi What is the Void in parenthesis. I am familiar
    Main() {...}
    and
    Void Main() {...}
    but what is the
    Void Main(Void)
    mean. How to pass one Void argument. Do you intend Void Main(Void *)....

    I find C very confused........

    On 24/12/2009 18:27, Keith Thompson wrote:
    > "Johannes Schaub (litb)" <> writes:
    >
    >>Keith Thompson wrote:

    >
    > [...]
    >
    >>>And if you incorrectly declare main as "void main(void)", your
    >>>program's behavior is undefined. It's an error that your compiler
    >>>isn't required to diagnose. So if your compiler quietly accepts it
    >>>and your program appears to work, that doesn't mean either that you
    >>>got it right or that your compiler got it wrong. It's entirely *your*
    >>>responsibility to get this right.

    >>
    >>I was in the impression that the C99 Standard allows implementations to
    >>provide additional return types. If an implementation supports "void", then
    >>behavior is not undefined. This is what i infer out of the "It shall be
    >>defined with return type of int ... or in some other implementation-defined
    >>manner."
    >>
    >>If, however, the implementation does not allow it, behavior is undefined. Is
    >>my interpretation wrong?

    >
    >
    > You're right. I left that out in the vain hope of avoiding yet
    > another lengthy discussion.
    >
    > Yes, an implementation may permit other declarations for main,
    > including "void main(void)". If a given implementation permits that
    > declaration (and documents it), then such a program's behavior is
    > well defined *for that implementation*.
    >
    > There is no good reason for an implementation to permit "void
    > main(void)", and no good reason for a programmer to take advantage
    > of it. "int main(void)" works everywhere.
    >
    > One quibble: on freestanding implementations (roughly speaking,
    > embedded systems), "void main(void)" might be perfectly sensible.
    > But most beginners don't use such implementations.
    >
     
    Wang Yip, Dec 24, 2009
    #10
  11. Wang Yip <> writes:
    > Hi What is the Void in parenthesis. I am familiar
    > Main() {...}
    > and
    > Void Main() {...}
    > but what is the
    > Void Main(Void)
    > mean. How to pass one Void argument. Do you intend Void Main(Void *)....
    >
    > I find C very confused........

    [...]

    Please don't top-post. See:
    http://www.caliburn.nl/topposting.html
    http://www.cpax.org.uk/prg/writings/topposting.php

    C is case-sensitive. "Main" and "main" are two distinct identifiers,
    as are "Void" and "void".

    In a function declaration, the "(void)" syntax means that the
    function has no parameters. It would have made more sense to use
    "()" for this, but for historical reasons this special-case syntax
    was necessary (empty parentheses already had a different meaning).

    This is a very elementary question. We're here to help (well,
    most of us are), but you're not going to have much luck learning
    the language by asking one question at a time. I think you'll be
    more successful if you use a good book. I recommend Kernighan &
    Ritchie's "The C Programming Language", 2nd edition, affectionately
    known as K&R2. There are also some good online tutorials (and a
    whole lot of really bad ones).

    See questions 18.9 and 18.10 of the comp.lang.c FAQ,
    <http://www.c-faq.com/>, and follow the links. (The FAQ is an
    excellent resource, but not suitable for learning the language
    from scratch.)

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Dec 24, 2009
    #11
  12. Wang Yip

    Wang Yip Guest

    Hi yet I not understand... How to pass a Void argument.

    In the code I use small letters but I find clearer to write with big
    letters Void to show is C type not word. I can not afford book... pls
    send a rapidshare link for "The C Programming Language" thanks......


    On 24/12/2009 18:58, Keith Thompson wrote:
    > Wang Yip <> writes:
    >
    >>Hi What is the Void in parenthesis. I am familiar
    >>Main() {...}
    >>and
    >>Void Main() {...}
    >>but what is the
    >>Void Main(Void)
    >>mean. How to pass one Void argument. Do you intend Void Main(Void *)....
    >>
    >>I find C very confused........

    >
    > [...]
    >
    > Please don't top-post. See:
    > http://www.caliburn.nl/topposting.html
    > http://www.cpax.org.uk/prg/writings/topposting.php
    >
    > C is case-sensitive. "Main" and "main" are two distinct identifiers,
    > as are "Void" and "void".
    >
    > In a function declaration, the "(void)" syntax means that the
    > function has no parameters. It would have made more sense to use
    > "()" for this, but for historical reasons this special-case syntax
    > was necessary (empty parentheses already had a different meaning).
    >
    > This is a very elementary question. We're here to help (well,
    > most of us are), but you're not going to have much luck learning
    > the language by asking one question at a time. I think you'll be
    > more successful if you use a good book. I recommend Kernighan &
    > Ritchie's "The C Programming Language", 2nd edition, affectionately
    > known as K&R2. There are also some good online tutorials (and a
    > whole lot of really bad ones).
    >
    > See questions 18.9 and 18.10 of the comp.lang.c FAQ,
    > <http://www.c-faq.com/>, and follow the links. (The FAQ is an
    > excellent resource, but not suitable for learning the language
    > from scratch.)
    >
     
    Wang Yip, Dec 24, 2009
    #12
  13. Wang Yip <> writes:
    > Hi yet I not understand... How to pass a Void argument.


    There is no such thing as a void argument. As I explained, in
    "int main(void)" the "(void)" is a special-case syntax that means
    that the function takes no arguments.

    > In the code I use small letters but I find clearer to write with big
    > letters Void to show is C type not word. I can not afford book... pls
    > send a rapidshare link for "The C Programming Language" thanks......

    [...]

    Again, please don't top-post. Your response belongs *below* any
    quoted text, not above it. Please read the following links before
    posting again:
    http://www.caliburn.nl/topposting.html
    http://www.cpax.org.uk/prg/writings/topposting.php

    Capitalizing words such as "void" and "main" that are inherently
    lowercase is not helpful, and will only cause confusion. If you
    want to make it clear that you're referring to a C keyword or
    identifier rather than an English word, find some other way to
    do it; quotation marks are usually a reasonable way to do this.
    In this context, though, even that probably isn't necessary; it's
    clear enough from context what void and main mean.

    I already cited questions 18.9 and 18.10 of the comp.lang.c FAQ,
    <http://www.c-faq.com/>. If you had read them, you would have
    found several online tutorials. I don't know what "rapidshare" is,
    but as far as I know there are no *legitimate* copies of K&R2 other
    than printed ones, and I won't help you obtain an illegitimate copy.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Dec 24, 2009
    #13
  14. Wang Yip

    Wang Yip Guest

    On 24/12/2009 20:01, Keith Thompson wrote:
    > Wang Yip <> writes:
    >
    >>Hi yet I not understand... How to pass a Void argument.

    >
    >
    > There is no such thing as a void argument. As I explained, in
    > "int main(void)" the "(void)" is a special-case syntax that means
    > that the function takes no arguments.
    >
    >
    >>In the code I use small letters but I find clearer to write with big
    >>letters Void to show is C type not word. I can not afford book... pls
    >>send a rapidshare link for "The C Programming Language" thanks......

    >
    > [...]
    >
    > Again, please don't top-post. Your response belongs *below* any
    > quoted text, not above it. Please read the following links before
    > posting again:
    > http://www.caliburn.nl/topposting.html
    > http://www.cpax.org.uk/prg/writings/topposting.php
    >
    > Capitalizing words such as "void" and "main" that are inherently
    > lowercase is not helpful, and will only cause confusion. If you
    > want to make it clear that you're referring to a C keyword or
    > identifier rather than an English word, find some other way to
    > do it; quotation marks are usually a reasonable way to do this.
    > In this context, though, even that probably isn't necessary; it's
    > clear enough from context what void and main mean.
    >
    > I already cited questions 18.9 and 18.10 of the comp.lang.c FAQ,
    > <http://www.c-faq.com/>. If you had read them, you would have
    > found several online tutorials. I don't know what "rapidshare" is,
    > but as far as I know there are no *legitimate* copies of K&R2 other
    > than printed ones, and I won't help you obtain an illegitimate copy.
    > Hi Thanks to your great help.... I understand now but when I try below

    program there is error.

    #define V (void)x

    f(void)
    {
    printf("calling f.........................\n");
    }

    main()
    {
    int x;
    f(V);
    }

    I also try with int main(void)..... But then if I give a command line
    parameter there is no error but I understand you say (void) is NO arguments.

    Rapidshare is free download site... look for it, many good warez.
     
    Wang Yip, Dec 24, 2009
    #14
  15. Wang Yip

    Seebs Guest

    On 2009-12-24, Johannes Schaub (litb) <> wrote:
    > I was in the impression that the C99 Standard allows implementations to
    > provide additional return types.


    It does, so does C89.

    > If an implementation supports "void", then
    > behavior is not undefined. This is what i infer out of the "It shall be
    > defined with return type of int ... or in some other implementation-defined
    > manner."


    > If, however, the implementation does not allow it, behavior is undefined. Is
    > my interpretation wrong?


    I don't think so. So I think that, if the documentation explicitly says
    that an alternative declaration is acceptable, it's no longer undefined,
    but it's reliant on implementation-defined behavior. There are other examples
    of such things:

    unsigned char *x;
    long l = 3;
    x = malloc(sizeof(int));
    memcpy(x, &l, sizeof(long));

    Obviously, this code is not portable, but whether or not it invokes undefined
    behavior is implementation-defined. On a platform where sizeof(long) is the
    same as sizeof(int), it does nothing undefined, it's merely stupid.

    -s
    --
    Copyright 2009, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
     
    Seebs, Dec 24, 2009
    #15
  16. Wang Yip

    Seebs Guest

    On 2009-12-24, Wang Yip <> wrote:
    > Hi What is the Void in parenthesis.


    There isn't one.

    Please stop capitalizing bits of code, that is incorrect. If you are trying
    to use the capitalization to call attention to a word, or separate it from
    the surrounding text, try:
    What is the "void" in parentheses?

    (Note also that "parenthesis" is singular, and that questions usually
    take question marks.)

    > I find C very confused........


    C isn't all that confused, but you are.

    -s
    p.s.: In a function declaration or definition, a parameter list consisting
    only of the word "void" is an explicit assertion that the function takes
    no arguments; in a definition, this is the same as an empty list, but in
    a declaration, an empty list might indicate a function about whose calling
    convention nothing is known.
    --
    Copyright 2009, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
     
    Seebs, Dec 24, 2009
    #16
  17. Wang Yip

    Seebs Guest

    On 2009-12-24, Wang Yip <> wrote:
    > Hi yet I not understand... How to pass a Void argument.


    You don't. That's used when there's no argument.

    > In the code I use small letters but I find clearer to write with big
    > letters Void to show is C type not word.


    Learn about quotes. (").

    > I can not afford book... pls
    > send a rapidshare link for "The C Programming Language" thanks......


    Yeah, we'll totally help you steal stuff. Not.

    If you can't afford a book, there's some online tutorials, but they aren't
    of great quality. My suggestion would be to save up for a book; my
    recommendation is usually Kim King's _C Programming: A Modern Approach_.
    The second edition is in print last I checked, and quite good -- it is the
    first C book I've ever seen that I'd actually recommend instead of K&R.

    -s
    --
    Copyright 2009, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
     
    Seebs, Dec 24, 2009
    #17
  18. Wang Yip

    Seebs Guest

    On 2009-12-24, Wang Yip <> wrote:
    > Hi Thanks to your great help.... I understand now but when I try below
    > program there is error.


    Then you don't understand now.

    > #define V (void)x


    Wrong.

    > f(void)
    > {
    > printf("calling f.........................\n");
    > }


    > main()
    > {
    > int x;
    > f(V);
    > }


    The correct call would be:

    f();

    > I also try with int main(void)..... But then if I give a command line
    > parameter there is no error but I understand you say (void) is NO arguments.


    Right. (void) means no function arguments, it doesn't say anything about
    what the calling enviroment might have done.

    > Rapidshare is free download site... look for it, many good warez.


    I'd like to walk you through this slowly.

    You are writing to programmers. Do you know what programmers do for a
    living, in general? They write programs. Many of these programs are
    sold. If the program does not sell, there is no job for the programmer.
    Some of us write books. If the book does not sell, there is no job for
    the writer. (I'm glossing over internal-use-only code, of which there is
    a fair bit, because it's a bit of a special case.)

    In short, you're coming to a group of people most of whom make money selling
    books or programs, and telling them that you are a big fan of downloading
    things without paying the creators for them. Now, can you imagine any way
    in which this could make people less likely to help you? I sure can.

    -s
    --
    Copyright 2009, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
     
    Seebs, Dec 24, 2009
    #18
  19. In article <>,
    Keith Thompson <> wrote:
    ....
    >C is case-sensitive. "Main" and "main" are two distinct identifiers,
    >as are "Void" and "void".


    Strictly speaking, void is not an identifier. Main, main, and Void
    are, though.

    Isn't infinite reducibility fun?
     
    Kenny McCormack, Dec 24, 2009
    #19
  20. Wang Yip

    Wang Yip Guest

    On 24/12/2009 20:33, Seebs wrote:
    > On 2009-12-24, Wang Yip <> wrote:
    >
    >>Hi Thanks to your great help.... I understand now but when I try below
    >>program there is error.

    >
    >
    > Then you don't understand now.
    >
    >
    >>#define V (void)x

    >
    >
    > Wrong.
    >
    >
    >>f(void)
    >>{
    >>printf("calling f.........................\n");
    >>}

    >
    >
    >>main()
    >>{
    >>int x;
    >>f(V);
    >>}

    >
    >
    > The correct call would be:
    >
    > f();
    >
    >
    >>I also try with int main(void)..... But then if I give a command line
    >>parameter there is no error but I understand you say (void) is NO arguments.

    >
    >
    > Right. (void) means no function arguments, it doesn't say anything about
    > what the calling enviroment might have done.
    >
    >
    >>Rapidshare is free download site... look for it, many good warez.

    >
    >
    > I'd like to walk you through this slowly.
    >
    > You are writing to programmers. Do you know what programmers do for a
    > living, in general? They write programs. Many of these programs are
    > sold. If the program does not sell, there is no job for the programmer.
    > Some of us write books. If the book does not sell, there is no job for
    > the writer. (I'm glossing over internal-use-only code, of which there is
    > a fair bit, because it's a bit of a special case.)
    >
    > In short, you're coming to a group of people most of whom make money selling
    > books or programs, and telling them that you are a big fan of downloading
    > things without paying the creators for them. Now, can you imagine any way
    > in which this could make people less likely to help you? I sure can.
    >
    > -s For call f(); I will just write

    f(){...}
    not
    f(void){...}

    What is difference with void. Both no arguments.

    What is calling environment???? Is not what I learn.

    Writers of book are very rich.. I am very poor.. I think they are happy
    to share books to developing countries......
     
    Wang Yip, Dec 24, 2009
    #20
    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. Ollej Reemt
    Replies:
    7
    Views:
    602
    Jack Klein
    Apr 22, 2005
  2. Stig Brautaset

    `void **' revisited: void *pop(void **root)

    Stig Brautaset, Oct 25, 2003, in forum: C Programming
    Replies:
    15
    Views:
    837
    The Real OS/2 Guy
    Oct 28, 2003
  3. Replies:
    5
    Views:
    882
    S.Tobias
    Jul 22, 2005
  4. int main(void) Why void?

    , Apr 6, 2006, in forum: C Programming
    Replies:
    6
    Views:
    521
  5. Replies:
    1
    Views:
    435
    Victor Bazarov
    May 23, 2007
Loading...

Share This Page