ctolowerimplicit-declaration

Can anyone tell me in details, why i am watching warning for this program?


#include<stdio.h>
#include<string.h>
int main()
{
    char input[102], output[210];
    int i=0;

    scanf("%s",input);

    for(i=0;i<strlen(input);i++)
    {
        if(tolower(input[i])=='o'|| tolower(input[i])=='i' || tolower(input[i])=='a' || tolower(input[i])== 'e'
           || tolower(input[i])=='u')
            continue;
        else
            printf(".%c",tolower(input[i]));

    }
}

When I run this code, it shows following warning,

implicit declaration of function ‘tolower’ [-Wimplicit-function-declaration]

    if(tolower(input[i])=='o'|| tolower(input[i])=='i' || tolower(input[i])=='a' || tolower(input[i])== 'e'

and sometimes output is unexpected,such as if I enter input:

input::xnhcigytnqcmy

output::.x.n.h.c.g.y.t.n.q.c.m.y

Expected output:

.x.n.h.c.g.t.n.q.c.m

So can anyone tell where am I making the mistake?


Solution

  • tolower() is prototyped in <ctype.h>. You got to include this header file.