Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int fun(char tab1[], char tab2[], char tab3[]){
  4. int i, j,a=0,b=0, k=0;
  5. for(i=0; tab1[a]!='\0' || tab2[b]!='\0'; i++){
  6. if(i%2==0){
  7. tab3[k]=tab1[a];
  8. a++;
  9. }
  10. else if(i%2==1) {
  11. tab3[k]=tab2[b];
  12. b++;
  13. }
  14. k++;
  15. }
  16. printf("%s", tab3);
  17. }
  18.  
  19. int main(void){
  20. char wyraz1[]="abcd";
  21. char wyraz2[]="efghijk";
  22. char wyraz3[]="";
  23. fun(wyraz1,wyraz2,wyraz3);
  24.  
  25.  
  26. return 0;
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement