+ 1

The spy life from code coach. Please check the errors in this code. Thanks in advance

Question: You are a secret agent, and you receive an encrypted message that needs to be decoded. The code that is being used flips the message backwards and inserts non-alphabetic characters in the message to make it hard to decipher. #include <stdio.h> #include<string.h> int main() { char org[100], ok[100], final[100]; fgets(org,sizeof (org),stdin); int i,l; l=strlen(org); for(i=0;i<l;i++) { if((org[i]<='A'&&org[i]>='Z')|| (org[i]<='a'&&org[i]>='z'||org[i]==" ")) { strcat(ok,org); } } final=strrev(ok); printf("%s",final); return 0; }

6th Aug 2020, 11:57 AM
O.Naga Lakshmi Lalasa
O.Naga Lakshmi Lalasa - avatar
1 Answer
0
strrev is non-standard function, will not work in sololearn.. strcat function appends total array every time in if condition is true.... And if condition is wrong ,check again once relational operator checking logic?.. one more for character space comparison use single quotes ' '. (" " is a string).
6th Aug 2020, 12:48 PM
Jayakrishna 🇼🇳