i need help to solve this

#include <stdio.h>
#include <stdlib.h>

void toLowerCase();

int main()

{
    system("cls");
        toLowerCase();


        return 0;

}


void toLowerCase()
{
    char ch, ch1;
    printf("\nEnter a character to convert: \n ");
    scanf("%c", &ch);
    ch1 = ch+32;
    printf("Converted value is %c", ch1);
    fflush(stdout);

}

Edited 3 Years Ago by Reverend Jim: Fixed formatting

The prototype should be:

void toLowerCase(void);

If you are receiving other warnings or errors, list them. If it's giving you wrong output, or messing up your input for some reason, show an example.

To troubleshoot a program, you have to be active and work at it.

P.S. What is the square brackets at the very top and bottom, about? If you want code tags (and you do need them for code), click on the CODE icon in the editor, and paste your code between the provided tags.

Edited 6 Years Ago by Adak: n/a

thanks i was able to find the problem only that i need it to add

void toLowerCase()
{
    char ch, ch1;

    printf("\nEnter a character to convert: \n ");
    fflush(stdout);
    scanf("%c", &ch);
    ch1 = ch-32;
    printf("Converted value is %c ", ch1);
    fflush(stdout);

}

and it worked fine, but thanks for the help

Edited 3 Years Ago by Reverend Jim: Fixed formatting

I don't like the idea that you are assuming that the user will always enter a capital letter. Why are you not using this?

#include <stdio.h>
#include <ctype.h>
ch1 = tolower(ch);

Its safer in that it checks weather the user typed upper-case or not.

This article has been dead for over six months. Start a new discussion instead.