whats wrong with the c code ?? it has to convert string to ASCII values char by char ..
#include
You are overstepping the bounds of the string in the loop. The string ranges from 0 to length-1, hence the equals is not correct. Also you can directly print the characters inside printf. #include<stdio.h> #include<string.h> int main() { int len,ctr,x; char str[100],ch; int c; puts("Enter the string to be encrypted "); gets(str); printf("the entered string is :\t "); puts(str); len = strlen(str); printf("the lenght of the string is : %d \n",len); for(ctr=0;ctr<len;ctr++) { printf("%d\n",str[ctr]); } return 0; }
Join our real-time social learning platform and learn together with your friends!