why is ctype.h used as a header file?
why is ctype.h used as a header file?
Page 1 of 16 Replies - 10861 Views - Last Post: 15 August 2006 - 06:08 AM
Replies To: why is ctype.h used as a header file?
#2
Re: why is ctype.h used as a header file?
Posted 14 August 2006 - 11:03 AM
... because it's a header file...
#3
Re: why is ctype.h used as a header file?
Posted 14 August 2006 - 11:15 AM
#4
Re: why is ctype.h used as a header file?
Posted 14 August 2006 - 11:17 AM
http://www-ccs.ucsd.edu/c/ctype.html
It should also be noted that the ctype.h library has been deprecated, and #include<cctype> should be used instead in C++
http://www.cs.bsu.ed...ders/cctype.htm
It should also be noted that the ctype.h library has been deprecated, and #include<cctype> should be used instead in C++
http://www.cs.bsu.ed...ders/cctype.htm
#5
Re: why is ctype.h used as a header file?
Posted 14 August 2006 - 11:00 PM
ctype (or cctype now) contains functions and MACRO's relating to a character's type.
For instance, case conversion functions are present in this header file and inclusion of this header file is required when you use the toupper() and tolower() functions.
You can even open the ctype.h in your Text Editor and have a look at all the functions and MACROs available.
For instance, case conversion functions are present in this header file and inclusion of this header file is required when you use the toupper() and tolower() functions.
You can even open the ctype.h in your Text Editor and have a look at all the functions and MACROs available.
#6
Re: why is ctype.h used as a header file?
Posted 15 August 2006 - 05:33 AM
born2c0de, on 14 Aug, 2006 - 11:00 PM, said:
ctype (or cctype now) contains functions and MACRO's relating to a character's type.
For instance, case conversion functions are present in this header file and inclusion of this header file is required when you use the toupper() and tolower() functions.
You can even open the ctype.h in your Text Editor and have a look at all the functions and MACROs available.
For instance, case conversion functions are present in this header file and inclusion of this header file is required when you use the toupper() and tolower() functions.
You can even open the ctype.h in your Text Editor and have a look at all the functions and MACROs available.
oh ya.... i have encountered this toupper() function,
the goes like this-
char ch,str[80];
for(;;)
{
do
{
printf("(E)nter grades \n");
printf("(R)eport grades \n");
gets(str);
ch=toupper(*str);
}
while(ch!='E'&& ch!='R' && ch!='Q');
switch(ch)
{
...
can you please explain what does toupper() and tolower() functions do... and how is toupper(*str) working here..?
#7
Re: why is ctype.h used as a header file?
Posted 15 August 2006 - 06:08 AM
toupper changes a character from lower case to upper case (by changing the related ASCII values). The code you've posted is calling the toupper() function with a character pointer as the paramter. you can read about the toupper function here:
http://www.opengroup...ns/toupper.html
http://www.opengroup...ns/toupper.html
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|