This blog is under construction

Saturday, 17 March 2012

toupper example in C

Header file:
    ctype.h

Synopsis:
    int toupper (int input)

Description:
    converts the given input to lower case if possible

Return Value:
    returns upper case of "input", if "input" is in lower case.  Otherwise "input" is returned unchanged.


toupper function C example:


  #include<stdio.h>
  #include<ctype.h>
  int main() {
        char c;
        printf("Enter your input:");
        c = getchar();
        printf("Result for the given input: %c\n", toupper(c));
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/cpgms$ ./a.out
  Enter your input:a
  Result for the given input: A



No comments:

Post a Comment