fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. char source[100] = "Source string";
  6. char destination[10];
  7.  
  8. const char *src = source;
  9. char *dst = destination;
  10. int max_len_copy = sizeof(destination);
  11.  
  12. while(*src != '\0' && max_len_copy-- > 1){
  13. *dst++ = *src++;
  14. }
  15. *dst = '\0';
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 5328KB
stdin
Standard input is empty
stdout
Standard output is empty