-4

I wrote a program to show the capital letter of a given small letter, but in the output console it's showing an error.

#include <stdio.h>

int main
{
    char small_letter, capital_letter;

    printf("Please enter a small letter: ");
    small_letter = getchar();
    capital_letter = small_letter - 32;
    printf("The capital letter is: %c\n", capital_letter);
    return 0;
}

show capital letter of given a small letter

karel
  • 5,489
  • 46
  • 45
  • 50
Shihab
  • 9
  • 2
  • 4
    Hi, Please post your code as text, not as image. You can [edit] your question using the link. – Stefan Mar 01 '19 at 06:35
  • 2
    multiple defination of main. both of your .c files are getting compiled together – LearningC Mar 01 '19 at 06:35
  • 3
    Please post your code and error message as text; that makes it easier for us to read without going to another page, and allows us to play around with the code in case it's a complicated reason. For more explanation, see https://idownvotedbecau.se/imageofcode and https://idownvotedbecau.se/imageofanexception; despite the domain name, I didn't downvote because you're new and it's easy enough to fix, I just think the pages are useful explanations. – Daniel H Mar 01 '19 at 06:38
  • Hi, welcome to StackOverflow. Please read these instructions on how to ask a good question - it'll help people to help you! https://stackoverflow.com/help/how-to-ask In the meantime, here is an answer which describes your problem. https://stackoverflow.com/a/21508751/7840778 – Steve Land Mar 01 '19 at 13:45

1 Answers1

1

The error seems to indicate you have multiple main functions. It looks like both of your files are being compiled together. In order to compile try renaming or deleting one of your main functions.

To explain a little further this is a linker error caused when the linker is not sure what is meant. In C you can declare functions with the same signature multiple times but you cannot define them multiple times.

Mr. S
  • 126
  • 6