Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int lower(int c); // If const is passed it must be declared
- int main()
- {
- int i, c;
- printf("Enter characters >");
- while((c=getchar())!=EOF && c!='\n') {
- i = lower(c);
- printf("%c",i);
- }
- puts(" ");
- return(0);
- }
- /* lower: convert c to lower case; ASCII only */
- int lower(int c)
- { // a ? b : c
- c = (c>='A' && c<='Z') ? (c+'a'-'A') : c; // if a return b else return c
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment