Written in C I have used this if loop in main function -->
if(islower(ch))
I'm finding the error as
:warning :implicit declaration of function 'islower'
if(islower(ch))
Why is it so?
Written in C I have used this if loop in main function -->
if(islower(ch))
I'm finding the error as
:warning :implicit declaration of function 'islower'
if(islower(ch))
Why is it so?
You need to include ctype.h, as follows:
#include <ctype.h>
This header file declares the function islower
:
int islower(int c);
This type of error comes when you call a function before it is defined. Consider the following code:
int main()
{
char ch= 'a';
if (islower(ch))
{
ch = ch - 32; // difference of ascii values between upper and lower case is 32
}
printf("%c ", ch);
return 0;
}
int islower(char ch)
{
if ('a' <= ch && ch <= 'z')
return 1;
else
return 0;
}
You will get that error because you are calling islower()
function before defining it. So just give the prototype of the function before calling. You can add int islower(char);
line before main as given below.
int islower(char);
int main()
{
char ch= 'a';
if (islower(ch))
{
ch = ch - 32; // difference of ascii values between upper and lower case is 32
}
printf("%c ", ch);
return 0;
}
int islower(char ch)
{
if ('a' <= ch && ch <= 'z')
return 1;
else
return 0;
}
Surely this gonna solve your problem. Hope this helps you. Let me know if anything else is needed.