Re: tolower() and toupper()
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Thu, 02 Nov 2006 14:27:27 -0500
Simon Biber wrote:
CBFalconer wrote:
"*** T. Winter" wrote:
"Roman Mashak" <mrv@xxxxxxxx> writes:
what's the point to declare argument to these functions of 'int'That is to make the following work:
type, not char?
int c1, c2;
while((c1 = getchar()) != EOF) {
c2 = tolower(c1);
}
Which, assuming you need both the values of c1 and c2 preserved, is
more simply written as:
while (EOF != (c2 = tolower(c1 = getchar))) continue;
since the tolower call will preserve the value EOF.
I think you meant to call getchar, rather than trying to assign a
function pointer to c1. A set of parentheses is missing.
Thanks for catching that. Should be:
while (EOF != (c2 = tolower(c1 = getchar()))) continue;
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
.
- References:
- tolower() and toupper()
- From: Roman Mashak
- Re: tolower() and toupper()
- From: *** T. Winter
- Re: tolower() and toupper()
- From: CBFalconer
- Re: tolower() and toupper()
- From: Simon Biber
- tolower() and toupper()
- Prev by Date: Re: Out-of-bounds nonsense
- Next by Date: Re: comparing ptrs/mmap
- Previous by thread: Re: tolower() and toupper()
- Next by thread: Question
- Index(es):