Hello
please
1-what is the proplem with this code
2-how can i use fgets in this code
3- can i use BUFSIZ
which will be more faster BUFSIZ or strlen()
Code:#include<stdio.h> #include<string.h> #include<stdbool.h> char toupper(char); char tolower(char); bool islower(char); bool isupper(char); int main(){ char str[20]; int i; printf("Enter any string:"); gets(str); for(i=0;i<=strlen(str);i++){ if(islower(str[i])==1) toupper(str[i]); else if(isupper(str[i])==1) tolower(str[i]); } printf("%s\n",str); return 0; } bool islower(char ch){ if(ch>='a'&&ch<='z') return 1; else return 0; } bool isupper(char ch) { if (ch<='A' && ch>='Z') return 1; else return 0; } char toupper(char ch) { if (ch <= 'a' && ch >= 'z') ch=ch+32; return ch; } char tolower(char ch) { if (ch <= 'A' &&ch >= 'Z') ch=ch-32; return ch; }



3Likes
LinkBack URL
About LinkBacks






