I want to update my C code with eliminating Ctype.h library -
i have written c code using ctype.h library . must update code same output , can't use ctype.h , string.h libraries . think should use new functions in , math not , don't know how can . searched couldn't find useful results . can me update code ? code works in way : when give reverse sentence , converts sentence usual.
example input: od uoy tnaw ot eunitnoc?
output: want continue?
here code :
#include <stdio.h> #include <ctype.h> int main() { char sentence[100]; int ch, i, j, k; (i=0; i<sizeof(sentence)-1; i++) if ((sentence[i] = getchar()) == '\n') break; sentence[i] = '\0'; (j = 0; j <=i; j++) { if(sentence[j]==' ' || sentence[j]=='\0') { for( k=j-1;sentence[k]!=' ' && k>=0;k--) { ch=sentence[k]; putchar(ch); } printf(" "); } } return 0; }
this code works correctly without both header files. have tried? – karthikeyan.r.s
Comments
Post a Comment