fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. void main(){
  4. char frame[50][50],str[50][50];
  5. char flag[10];
  6. strcpy(flag,"f");
  7. char esc[10];
  8. strcpy(esc,"e");
  9. int i,j,k=0,n;
  10. strcpy(frame[k++],"f");
  11. printf("Enter no.of String :\t");
  12. scanf("%d",&n);
  13. printf("Enter String \n");
  14. for(i=0;i<=n;i++)
  15. {
  16. gets(str[i]);
  17. }
  18. printf("You entered :\n");
  19. for(i=0;i<=n;i++)
  20. {
  21. puts(str[i]);
  22. }
  23. printf("\n");
  24. for(i=1;i<=n;i++)
  25. {
  26. if(strcmp(str[i],flag)!=0 && strcmp(str[i],esc)!=0)
  27. {
  28. strcpy(frame[k++],str[i]);
  29. }
  30. else
  31. {
  32. strcpy(frame[k++],"e");
  33. strcpy(frame[k++],str[i]);
  34. }
  35. }
  36. strcpy(frame[k++],"f");
  37. //frame[k++]='\0';
  38. printf("------------------------------\n");
  39. printf("Byte stuffing at sender side:\n\n");
  40. printf("------------------------------\n");
  41. for(i=0;i<k;i++)
  42. {
  43. printf("%s\t",frame[i]);
  44. }
  45. printf("---------------------\n");
  46. printf("Byte Stuffing at receivers side :\n\n")
  47. for(i=0;i<n;i++)
  48. {
  49. printf("%s\t",str[i]);
  50. }
  51. }
Compilation error #stdin compilation error #stdout 0s 9424KB
stdin
8
h
e
l
l
o
f
a
n
compilation info
prog.c:3:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
 void main(){
      ^~~~
prog.c: In function ‘main’:
prog.c:16:3: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]
   gets(str[i]);
   ^~~~
prog.c:47:3: error: expected ‘;’ before ‘for’
   for(i=0;i<n;i++)
   ^~~
prog.c:9:8: warning: unused variable ‘j’ [-Wunused-variable]
  int i,j,k=0,n;
        ^
stdout
Standard output is empty