about sentinel - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

about sentinel

What is the meaning of sentinel -999?
Is that the limitation value of StudentNumber?





[code]
#include
#define sentinel -999
int main
{int StudentNumber;
....
....
while(StudentNumber!=sentinel)
{
....
}
return 0;
}


[/code]



Comments

  • Ed HallEd Hall Posts: 395Member
    It looks like it's just a way to break out of the while loop. I would expect that student numbers would all be positive and you can keep entering data until you enter -999. Then the while loop is broken. The term "sentinel" is probably used to signify that it is "watching" for the -999.

    Take Care,
    Ed
  • toddlerasimtoddlerasim Posts: 93Member
    : What is the meaning of sentinel -999?
    : Is that the limitation value of StudentNumber?
    :
    :
    :
    :
    :
    : [code]:
    : #include
    : #define sentinel -999
    : int main
    : {int StudentNumber;
    : ....
    : ....
    : while(StudentNumber!=sentinel)
    : {
    : ....
    : }
    : return 0;
    : }
    :
    :
    : [/code]:
    :
    : That sounds just very right. Like the name "sentinel" for a variable to do just that ... keep watch. Think I will add it to my list of fixed variable names. Thanks for the post.

    But then I am a toddler in C/C++.
    :
    :
Sign In or Register to comment.