-2

I want the the letter "i" to show as uppercase. I have tried to pass the "i" to another char, it is still not working.

#include<stdio.h>
#include<string.h>
int main()
{
    char str[6] = "modify";
    char maj = str[4];

    printf("%c\n", strupr (maj));

}
Abdullah
  • 131
  • 1
  • 10

1 Answers1

4

There is no strupr. You need toupper() instead, and that needs #include<ctype.h>

artm
  • 17,291
  • 6
  • 38
  • 54
  • Isn't it possible with "strupr"? Because i have been looking some examples and poeple made it using "strupr". – Abdullah Jan 14 '17 at 22:59
  • @Abdullah that was Microsoft stuff and also had been obsolete: http://stackoverflow.com/questions/26327812/strupr-and-strlwr-in-string-h-part-are-of-the-ansi-standard – artm Jan 14 '17 at 23:01
  • you'd better off sticking with standard function – artm Jan 14 '17 at 23:02
  • 1
    @Abdullah: *of course* it's possible with a function such as `strupr`, but it works on *entire strings* (so you'd have to make your single character into a valid string) ... but for a single character, just use `toupper()`. – Jongware Jan 14 '17 at 23:11