Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- int *toUpper(char *str){
- if (str) {
- if (str[0] != '\0'){ // check the first element
- int i;
- for (i = 0; i < strlen(str); i++) {
- if (str[i] >= 'a' && str[i] <= 'z') {
- str[i] = str[i] - 'a' + 'A';
- }
- }
- }
- return str;
- }
- else{ // else
- printf("rossz");
- return NULL; //indicate error condition
- }
- }
- int main(int argc, char **argv)
- {
- for (int i = 1; i < argc; ++i)
- {
- printf(toUpper(argv[i]));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement