Endless loop question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tweaxor

    #1

    Endless loop question

    This has been puzzling me all this week. This is actually a homework
    assignment
    from last semesmter. But the teacher wouldn't tell us why certain
    things didn't work, but it didn't just work. My thing was what
    actually turn this while loop into an endless loop instead of waiting
    for user response it'll would skip right over it. Could someone with
    the time explain this to me what would make it behave like this


    int pts1, pts2, pts3, wk_exp, p_pay, total_pts, total_pay;
    char degree, again;

    int main() {
    char again = 'Y';

    while (again != 'N')
    {

    printf("\nEnter degree type: (B for Bachelors), (M for Masters), (D
    for Doctorate\n");
    printf("\t\t\t: ");
    scanf("%1c", &degree);
    if (degree = 'B') {
    pts1 = 3;
    }
    if (degree = 'M') {
    pts1 = 5;
    }
    if (degree = 'D') {
    pts1 =7;
    }


    printf("\nEnter number of years of work experience: ");
    scanf("%2d",&wk _exp);
    if (wk_exp <= 3) {
    pts2 = 4;
    }
    if (wk_exp >= 4 && wk_exp <= 6) {
    pts2 = 7;
    }
    if (wk_exp >= 7) {
    pts2 = 10;
    }

    printf("\nEnter current Pay: ");
    scanf("%5d",&p_ pay);
    if (p_pay <= 15000) {
    pts3 = 4;
    }
    if (p_pay >= 15001 && p_pay <= 22500) {
    pts3 = 8;
    }
    if (p_pay > 22500) {
    pts3 = 12;
    }

    total_pts = pts1 + pts2 + pts3;
    if (total_pts <= 19) {
    total_pay = 25000;
    }
    if (total_pts >= 20 && total_pts <= 28) {
    total_pay = 30000;
    }
    else if (total_pts >= 29) {
    total_pay = 35000;
    }

    printf("\nThe pay rate is: %d\n",total_pay );

    printf("\nWant to do this again? Press N for NO: ");
    /*scanf("%1c", &again); */
    getchar();
    }

    return (0) ;
    }
  • Mark A. Odell

    #2
    Re: Endless loop question

    phaza7@yahoo.co m (Tweaxor) wrote in
    news:1c0c25ba.0 409290912.14fef b61@posting.goo gle.com:
    [color=blue]
    > This has been puzzling me all this week. This is actually a homework
    > assignment
    > from last semesmter. But the teacher wouldn't tell us why certain
    > things didn't work, but it didn't just work. My thing was what
    > actually turn this while loop into an endless loop instead of waiting
    > for user response it'll would skip right over it. Could someone with
    > the time explain this to me what would make it behave like this
    >[/color]

    None of these seem to need to be defined outside of main().
    [color=blue]
    > int pts1, pts2, pts3, wk_exp, p_pay, total_pts, total_pay;
    > char degree, again;
    >
    > int main() {[/color]
    Ick ^^^^^^^^

    int main(void)
    {
    [color=blue]
    > char again = 'Y';
    >
    > while (again != 'N')
    > {
    > /*scanf("%1c", &again); */
    > getchar();
    > }
    >
    > return (0) ;
    >
    > }[/color]

    Since again is initially == 'Y', explain how again will ever be anything
    but 'Y'. Then see why the while loop becomes endless.

    --
    - Mark ->
    --

    Comment

    • S.Tobias

      #3
      Re: Endless loop question

      Mark A. Odell <odellmark@hotm ail.com> wrote:[color=blue]
      > phaza7@yahoo.co m (Tweaxor) wrote in
      > news:1c0c25ba.0 409290912.14fef b61@posting.goo gle.com:[/color]
      [color=blue][color=green]
      > > int main() {[/color]
      > Ick ^^^^^^^^[/color]
      [color=blue]
      > int main(void)
      > {[/color]

      No, why? You can drop `void' in function definition, can't you?

      --
      Stan Tobias
      sed 's/[A-Z]//g' to email

      Comment

      • Alan Balmer

        #4
        Re: Endless loop question

        On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
        [color=blue]
        >Mark A. Odell <odellmark@hotm ail.com> wrote:[color=green]
        >> phaza7@yahoo.co m (Tweaxor) wrote in
        >> news:1c0c25ba.0 409290912.14fef b61@posting.goo gle.com:[/color]
        >[color=green][color=darkred]
        >> > int main() {[/color]
        >> Ick ^^^^^^^^[/color]
        >[color=green]
        >> int main(void)
        >> {[/color]
        >
        >No, why? You can drop `void' in function definition, can't you?[/color]

        They mean different things. '(void)' tells the compiler there are no
        arguments. '()' tells the compiler that the arguments are unspecified.

        --
        Al Balmer
        Balmer Consulting
        removebalmercon sultingthis@att .net

        Comment

        • Dave Vandervies

          #5
          Re: Endless loop question

          In article <07vll0dmhqi8mg ikmh7gtdk1qs1cr qqk0s@4ax.com>,
          Alan Balmer <albalmer@spamc op.net> wrote:[color=blue]
          >On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
          >[color=green]
          >>Mark A. Odell <odellmark@hotm ail.com> wrote:[color=darkred]
          >>> phaza7@yahoo.co m (Tweaxor) wrote in
          >>> news:1c0c25ba.0 409290912.14fef b61@posting.goo gle.com:[/color]
          >>[color=darkred]
          >>> > int main() {
          >>> Ick ^^^^^^^^[/color]
          >>[color=darkred]
          >>> int main(void)
          >>> {[/color]
          >>
          >>No, why? You can drop `void' in function definition, can't you?[/color]
          >
          >They mean different things. '(void)' tells the compiler there are no
          >arguments. '()' tells the compiler that the arguments are unspecified.[/color]

          In this case, though, the distinction doesn't make any difference; one
          form means "Here's the definition of a function called main, returning
          int and taking no arguments, without a prototype" and the other form
          means "Here's the definition of a function called main, returning int
          and taking no arguments, with a prototype".

          Unless, of course, you're planning on calling main later on with a
          nonempty argument list. But if you really want to lie to the compiler,
          a prototype won't stop you either.


          dave
          ((int (*)())main)(arg v,argc);

          --
          Dave Vandervies dj3vande@csclub .uwaterloo.ca
          Shoot. Maybe I should port [GCC] to MMIX to get some [experience]
          on my own.
          --Ben Pfaff in comp.lang.c

          Comment

          • S.Tobias

            #6
            Re: Endless loop question

            Alan Balmer <albalmer@att.n et> wrote:[color=blue]
            > On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:[/color]
            [color=blue][color=green]
            > >No, why? You can drop `void' in function definition, can't you?[/color][/color]
            [color=blue]
            > They mean different things. '(void)' tells the compiler there are no
            > arguments. '()' tells the compiler that the arguments are unspecified.[/color]

            In declarations that are not definitions.

            What can be unspecified in function definition?
            int f() {}

            Grep through n869.txt - there are two examples using "int main()"
            (and one "int main(void)") declaration. They wouldn't miss an error
            like that, would they?

            --
            Stan Tobias
            sed 's/[A-Z]//g' to email

            Comment

            • 187

              #7
              Re: Endless loop question

              Alan Balmer wrote:[color=blue]
              > On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
              >[color=green]
              >> Mark A. Odell <odellmark@hotm ail.com> wrote:[color=darkred]
              >>> phaza7@yahoo.co m (Tweaxor) wrote in
              >>> news:1c0c25ba.0 409290912.14fef b61@posting.goo gle.com:[/color]
              >>[color=darkred]
              >>>> int main() {
              >>> Ick ^^^^^^^^[/color]
              >>[color=darkred]
              >>> int main(void)
              >>> {[/color]
              >>
              >> No, why? You can drop `void' in function definition, can't you?[/color]
              >
              > They mean different things. '(void)' tells the compiler there are no
              > arguments. '()' tells the compiler that the arguments are unspecified.[/color]

              but when it coems down to it, I've never seen any difference in actual
              behavior between the two. When it comes to normal functions, there is no
              difference.


              Comment

              • Flash Gordon

                #8
                Re: Endless loop question

                On Wed, 29 Sep 2004 18:30:11 +0000 (UTC)
                dj3vande@csclub .uwaterloo.ca (Dave Vandervies) wrote:
                [color=blue]
                > In article <07vll0dmhqi8mg ikmh7gtdk1qs1cr qqk0s@4ax.com>,
                > Alan Balmer <albalmer@spamc op.net> wrote:[color=green]
                > >On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
                > >[color=darkred]
                > >>Mark A. Odell <odellmark@hotm ail.com> wrote:
                > >>> phaza7@yahoo.co m (Tweaxor) wrote in
                > >>> news:1c0c25ba.0 409290912.14fef b61@posting.goo gle.com:
                > >>
                > >>> > int main() {
                > >>> Ick ^^^^^^^^
                > >>
                > >>> int main(void)
                > >>> {
                > >>
                > >>No, why? You can drop `void' in function definition, can't you?[/color]
                > >
                > >They mean different things. '(void)' tells the compiler there are no
                > >arguments. '()' tells the compiler that the arguments are
                > >unspecified.[/color]
                >
                > In this case, though, the distinction doesn't make any difference; one
                > form means "Here's the definition of a function called main, returning
                > int and taking no arguments, without a prototype" and the other form
                > means "Here's the definition of a function called main, returning int
                > and taking no arguments, with a prototype".[/color]

                So why not give the compiler all the information you have? It's
                generally a good habit and if you[1] break it for main you are likely to
                break it for other functions.
                [color=blue]
                > Unless, of course, you're planning on calling main later on with a
                > nonempty argument list. But if you really want to lie to the
                > compiler, a prototype won't stop you either.[/color]

                Actually, if there is a prototype in scope and you pass an incorrect
                number of parameters the compiler is (I believe) *required* to produce a
                diagnostic.

                [1] The generic you, not the specific you.
                --
                Flash Gordon
                Sometimes I think shooting would be far too good for some people.
                Although my email address says spam, it is real and I read it.

                Comment

                • Mark A. Odell

                  #9
                  Re: Endless loop question

                  "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote in
                  news:2s0c5rF1e6 f4aU1@uni-berlin.de:

                  [color=blue][color=green][color=darkred]
                  >> > int main() {[/color]
                  >> Ick ^^^^^^^^[/color]
                  >[color=green]
                  >> int main(void)
                  >> {[/color]
                  >
                  > No, why? You can drop `void' in function definition, can't you?[/color]

                  I just said "Ick", it's not wrong, just lazy IMHO.

                  --
                  - Mark ->
                  --

                  Comment

                  • Alan Balmer

                    #10
                    Re: Endless loop question

                    On 29 Sep 2004 19:00:34 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
                    [color=blue]
                    >Alan Balmer <albalmer@att.n et> wrote:[color=green]
                    >> On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:[/color]
                    >[color=green][color=darkred]
                    >> >No, why? You can drop `void' in function definition, can't you?[/color][/color]
                    >[color=green]
                    >> They mean different things. '(void)' tells the compiler there are no
                    >> arguments. '()' tells the compiler that the arguments are unspecified.[/color]
                    >
                    >In declarations that are not definitions.
                    >
                    >What can be unspecified in function definition?
                    >int f() {}
                    >
                    >Grep through n869.txt - there are two examples using "int main()"
                    >(and one "int main(void)") declaration. They wouldn't miss an error
                    >like that, would they?[/color]

                    The examples are not the standard. Your copy of the draft probably
                    includes section 5.1.2.2.1, paragraph 1, which gives the two allowable
                    forms, plus allows other *implementation-defined* forms. If the OP's
                    implementation documents that usage, it's OK. It probably doesn't.

                    --
                    Al Balmer
                    Balmer Consulting
                    removebalmercon sultingthis@att .net

                    Comment

                    • Alan Balmer

                      #11
                      Re: Endless loop question

                      On Wed, 29 Sep 2004 12:34:22 -0700, "187"
                      <bigal187@inval id.rx.eastcoast tfc.com> wrote:
                      [color=blue]
                      >Alan Balmer wrote:[color=green]
                      >> On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
                      >>[color=darkred]
                      >>> Mark A. Odell <odellmark@hotm ail.com> wrote:
                      >>>> phaza7@yahoo.co m (Tweaxor) wrote in
                      >>>> news:1c0c25ba.0 409290912.14fef b61@posting.goo gle.com:
                      >>>
                      >>>>> int main() {
                      >>>> Ick ^^^^^^^^
                      >>>
                      >>>> int main(void)
                      >>>> {
                      >>>
                      >>> No, why? You can drop `void' in function definition, can't you?[/color]
                      >>
                      >> They mean different things. '(void)' tells the compiler there are no
                      >> arguments. '()' tells the compiler that the arguments are unspecified.[/color]
                      >
                      >but when it coems down to it, I've never seen any difference in actual
                      >behavior between the two. When it comes to normal functions, there is no
                      >difference.
                      >[/color]
                      If your compiler is paying attention, you should see a difference. If
                      you use "void", the compiler should complain when you invoke the
                      function with a parameter.

                      --
                      Al Balmer
                      Balmer Consulting
                      removebalmercon sultingthis@att .net

                      Comment

                      • Dave Vandervies

                        #12
                        Re: Endless loop question

                        In article <ieer22xvq8.ln2 @brenda.flash-gordon.me.uk>,
                        Flash Gordon <spam@flash-gordon.me.uk> wrote:[color=blue]
                        >On Wed, 29 Sep 2004 18:30:11 +0000 (UTC)
                        >dj3vande@csclu b.uwaterloo.ca (Dave Vandervies) wrote:
                        >[color=green]
                        >> In article <07vll0dmhqi8mg ikmh7gtdk1qs1cr qqk0s@4ax.com>,
                        >> Alan Balmer <albalmer@spamc op.net> wrote:[color=darkred]
                        >> >On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
                        >> >
                        >> >>Mark A. Odell <odellmark@hotm ail.com> wrote:
                        >> >>> phaza7@yahoo.co m (Tweaxor) wrote in
                        >> >>> news:1c0c25ba.0 409290912.14fef b61@posting.goo gle.com:
                        >> >>
                        >> >>> > int main() {
                        >> >>> Ick ^^^^^^^^
                        >> >>
                        >> >>> int main(void)
                        >> >>> {
                        >> >>
                        >> >>No, why? You can drop `void' in function definition, can't you?
                        >> >
                        >> >They mean different things. '(void)' tells the compiler there are no
                        >> >arguments. '()' tells the compiler that the arguments are
                        >> >unspecified.[/color]
                        >>
                        >> In this case, though, the distinction doesn't make any difference; one
                        >> form means "Here's the definition of a function called main, returning
                        >> int and taking no arguments, without a prototype" and the other form
                        >> means "Here's the definition of a function called main, returning int
                        >> and taking no arguments, with a prototype".[/color]
                        >
                        >So why not give the compiler all the information you have? It's
                        >generally a good habit and if you[1] break it for main you are likely to
                        >break it for other functions.[/color]

                        Since main is already special in other ways, and since it's quite rare
                        for a programmer to write code that calls it, I don't see this as being
                        worth even an "Ick", only a "It's generally considered good form to
                        write this as..." (if even that).

                        (I would be entirely unsurprised to find that a large proportion, perhaps
                        even a majority, of programmers think of "int main()" (or "main()") as
                        "Define the entry point of this program" rather than "Define a function
                        called main [which happens to be the entry point of this program]",
                        so not writing a full prototype definition for main doesn't necessarily
                        indicate sloppiness that would carry over to writing other functions.)

                        [color=blue][color=green]
                        >> Unless, of course, you're planning on calling main later on with a
                        >> nonempty argument list. But if you really want to lie to the
                        >> compiler, a prototype won't stop you either.[/color]
                        >
                        >Actually, if there is a prototype in scope and you pass an incorrect
                        >number of parameters the compiler is (I believe) *required* to produce a
                        >diagnostic.[/color]

                        ....if you call it through the function name given in the prototype and
                        not, say, cast it to a nonprototyped function pointer type and call
                        through that.

                        Like I said, if you really want to lie to the compiler, a prototype
                        won't stop you.


                        dave

                        --
                        Dave Vandervies dj3vande@csclub .uwaterloo.ca
                        Shoot. Maybe I should port [GCC] to MMIX to get some [experience]
                        on my own.
                        --Ben Pfaff in comp.lang.c

                        Comment

                        • Flash Gordon

                          #13
                          Re: Endless loop question

                          On Wed, 29 Sep 2004 20:22:20 +0000 (UTC)
                          dj3vande@csclub .uwaterloo.ca (Dave Vandervies) wrote:
                          [color=blue]
                          > In article <ieer22xvq8.ln2 @brenda.flash-gordon.me.uk>,
                          > Flash Gordon <spam@flash-gordon.me.uk> wrote:[color=green]
                          > >On Wed, 29 Sep 2004 18:30:11 +0000 (UTC)
                          > >dj3vande@csclu b.uwaterloo.ca (Dave Vandervies) wrote:[/color][/color]

                          <snip int main() vs int main(void)
                          [color=blue][color=green]
                          > >So why not give the compiler all the information you have? It's
                          > >generally a good habit and if you[1] break it for main you are likely
                          > >to break it for other functions.[/color]
                          >
                          > Since main is already special in other ways, and since it's quite rare
                          > for a programmer to write code that calls it, I don't see this as
                          > being worth even an "Ick", only a "It's generally considered good form
                          > to write this as..." (if even that).
                          >
                          > (I would be entirely unsurprised to find that a large proportion,
                          > perhaps even a majority, of programmers think of "int main()" (or
                          > "main()") as"Define the entry point of this program" rather than
                          > "Define a function called main [which happens to be the entry point of
                          > this program]",[/color]

                          I agree so far.
                          [color=blue]
                          > so not writing a full prototype definition for main
                          > doesn't necessarily indicate sloppiness that would carry over to
                          > writing other functions.)[/color]

                          Unfortunately it seems like a lot of programmers think of () as the
                          parameter list for no parameters.
                          [color=blue][color=green][color=darkred]
                          > >> Unless, of course, you're planning on calling main later on with a
                          > >> nonempty argument list. But if you really want to lie to the
                          > >> compiler, a prototype won't stop you either.[/color]
                          > >
                          > >Actually, if there is a prototype in scope and you pass an incorrect
                          > >number of parameters the compiler is (I believe) *required* to
                          > >produce a diagnostic.[/color]
                          >
                          > ...if you call it through the function name given in the prototype and
                          > not, say, cast it to a nonprototyped function pointer type and call
                          > through that.[/color]

                          Precisely. It means you have to work to do it, whereas not specifying
                          the parameter list makes calling a function (even main) with incorrect
                          parameters all too easy.
                          [color=blue]
                          > Like I said, if you really want to lie to the compiler, a prototype
                          > won't stop you.[/color]

                          In that case I suggest you disable all warnings possibly on your
                          compiler since you can always find a way of achieving the same effect
                          without invoking the warnings.

                          In the mean time I will try to make the compiler warn me about all the
                          problems it can be made to detect (which don't generate spurious
                          warnings) since it generally improves code quality.
                          --
                          Flash Gordon
                          Sometimes I think shooting would be far too good for some people.
                          Although my email address says spam, it is real and I read it.

                          Comment

                          • S.Tobias

                            #14
                            Re: Endless loop question

                            Alan Balmer <albalmer@att.n et> wrote:[color=blue]
                            > On 29 Sep 2004 19:00:34 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:[/color]
                            [color=blue][color=green]
                            > >Alan Balmer <albalmer@att.n et> wrote:[color=darkred]
                            > >> On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:[/color]
                            > >[color=darkred]
                            > >> >No, why? You can drop `void' in function definition, can't you?[/color]
                            > >[color=darkred]
                            > >> They mean different things. '(void)' tells the compiler there are no
                            > >> arguments. '()' tells the compiler that the arguments are unspecified.[/color]
                            > >
                            > >In declarations that are not definitions.
                            > >
                            > >What can be unspecified in function definition?
                            > >int f() {}
                            > >
                            > >Grep through n869.txt - there are two examples using "int main()"
                            > >(and one "int main(void)") declaration. They wouldn't miss an error
                            > >like that, would they?[/color][/color]
                            [color=blue]
                            > The examples are not the standard. Your copy of the draft probably[/color]

                            True. If that's so then faq is also guilty, and K&R2 is
                            the greatest offender.
                            [color=blue]
                            > includes section 5.1.2.2.1, paragraph 1, which gives the two allowable
                            > forms, plus allows other *implementation-defined* forms.[/color]

                            .... or equivalent, you forgot to add.
                            [color=blue]
                            > implementation documents that usage, it's OK. It probably doesn't.[/color]

                            6.7.5.3

                            10 The special case of an unnamed parameter of type void as the only
                            item in the list specifies that the function has no parameters.

                            14 [...] An empty list in a function declarator that is part of a
                            definition of that function specifies that the function has no
                            parameters. The empty list in a function declarator that is not part
                            of a definition of that function specifies that no information about
                            the number or types of the parameters is supplied.

                            If
                            void f() {}
                            and
                            void f(void) {}
                            are not equivalent, then my brain must be seriously in trouble.

                            --
                            Stan Tobias
                            sed 's/[A-Z]//g' to email

                            Comment

                            • Alan Balmer

                              #15
                              Re: Endless loop question

                              On 30 Sep 2004 00:36:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
                              [color=blue]
                              >Alan Balmer <albalmer@att.n et> wrote:[color=green]
                              >> On 29 Sep 2004 19:00:34 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:[/color]
                              >[color=green][color=darkred]
                              >> >Alan Balmer <albalmer@att.n et> wrote:
                              >> >> On 29 Sep 2004 18:11:07 GMT, "S.Tobias" <sNOiSPAMt@amu. edu.pl> wrote:
                              >> >
                              >> >> >No, why? You can drop `void' in function definition, can't you?
                              >> >
                              >> >> They mean different things. '(void)' tells the compiler there are no
                              >> >> arguments. '()' tells the compiler that the arguments are unspecified.
                              >> >
                              >> >In declarations that are not definitions.
                              >> >
                              >> >What can be unspecified in function definition?
                              >> >int f() {}
                              >> >
                              >> >Grep through n869.txt - there are two examples using "int main()"
                              >> >(and one "int main(void)") declaration. They wouldn't miss an error
                              >> >like that, would they?[/color][/color]
                              >[color=green]
                              >> The examples are not the standard. Your copy of the draft probably[/color]
                              >
                              >True. If that's so then faq is also guilty, and K&R2 is
                              >the greatest offender.
                              >[color=green]
                              >> includes section 5.1.2.2.1, paragraph 1, which gives the two allowable
                              >> forms, plus allows other *implementation-defined* forms.[/color]
                              >
                              >... or equivalent, you forgot to add.
                              >[color=green]
                              >> implementation documents that usage, it's OK. It probably doesn't.[/color]
                              >
                              >6.7.5.3
                              >
                              >10 The special case of an unnamed parameter of type void as the only
                              > item in the list specifies that the function has no parameters.
                              >
                              >14 [...] An empty list in a function declarator that is part of a
                              > definition of that function specifies that the function has no
                              > parameters. The empty list in a function declarator that is not part
                              > of a definition of that function specifies that no information about
                              > the number or types of the parameters is supplied.
                              >
                              >If
                              > void f() {}
                              >and
                              > void f(void) {}
                              >are not equivalent, then my brain must be seriously in trouble.[/color]

                              First, this has nothing to do with the standard's specification of the
                              "main" function. Second, read again what you quoted above, carefully.
                              It tells you what the difference is and where it applies.

                              Bottom line: if you have a function which takes no parameters, it is
                              never wrong to use "void" in its declarator. If you do, the compiler
                              will check for proper usage. It really takes little extra effort, and
                              is not worth discussing further.

                              --
                              Al Balmer
                              Balmer Consulting
                              removebalmercon sultingthis@att .net

                              Comment

                              Working...