fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void)
  5. {
  6. char even[4];
  7. char odd[4];
  8. char res[7];
  9. strcpy(even, "abc");
  10. strcpy(odd,"123");
  11. int pop;
  12. printf("even %s\n", even);
  13. printf("odd %s\n", odd);
  14. pop = sizeof(res)-1;
  15. int j;
  16.  
  17. for (j=0; j<pop; ++j)
  18. {
  19. if (j%2 == 0 ) {
  20. res[j] = even[j/2];
  21. }
  22. else{
  23. res[j] = odd[(j-1)/2];
  24. }
  25. }
  26. res[j] = '\0';
  27. printf("String is %s",res);
  28. }
  29.  
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
even abc
odd 123
String is a1b2c3