#include <stdio.h> int main() { int i,lgth; char str[100]="\0"; gets(str); lgth=0; while(*(str+lgth)!='\0')lgth++; printf("The length of this string is %d\n",lgth); printf("%c",*str); for(i=1;i<lgth;i++) printf("#%c",*(str+i)); printf("\n"); return 0; }
#include <stdio.h> int main (void) { char str[20],*ptr=str,*end; end=ptr; printf("Enter a string:"); gets(ptr); while(*end) end++; printf ("Length of String is %i\n",end-ptr); while(*ptr) printf ("%c#",*ptr++); printf("\b"); return 0; }