fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. { char s1[50],s2[50];
  5. int count = 0;
  6.  
  7. printf("Bob: ");
  8. gets(s1);
  9.  
  10. printf("Alice: ");
  11. gets(s2);
  12.  
  13. strcat(s1, s2);
  14. printf("s1 : %s\n", s1);
  15. printf("s1 has length : %lu\n", strlen(s1));
  16. for (int i; i<strlen(s1); i++) {
  17. if (s1[i]=='i') {
  18. count++;
  19. }
  20. }
  21. printf("Count = : %d\n", count);
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Bob: Alice: s1 : ��
s1 has length : 7
Count = : 0