While loop

  • Thread starter chetzread
  • Start date
  • #1
801
1

Homework Statement


for teh circled part , why there's again =='y' ? i didnt see the variable 'y' anywhere other than the circled part ...What does it mean ?

Homework Equations




The Attempt at a Solution


Is the code wrong ?
 

Attachments

Answers and Replies

  • #2
gneill
Mentor
20,813
2,786
Characters in quotes are character constants. The statement in question is checking whether the user has input a 'Y' or a 'y' (so that both upper and lower case are checked).
 
  • #3
33,937
5,585
@chetzread, before you learned about loops and other control structures, there was probably some mention about the various types of constants that can be used in C. At least most of the books I've seen present such material in that order.

Character constants, such as 'y' or 'B' or '\t'
String constants, such as "cat"
integer constants, such as 23, 023, and 0x23 (all with different values)
floating point constants, such as 2.7 (a double) and 3.09F (a float)
This is not meant to be an exhaustive list.
 

Related Threads on While loop

  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
7
Views
1K
  • Last Post
Replies
15
Views
5K
  • Last Post
Replies
5
Views
5K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
1
Views
2K
Replies
0
Views
686
Replies
5
Views
4K
Replies
1
Views
1K
Replies
4
Views
855
Top