fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. char s[] = "0123456789";
  5.  
  6. void shift_string(char *s){
  7. int n = strlen( s );
  8. s[n] = s[0];
  9. memmove( s, s+1, n );
  10. s[n] = '\0';
  11. }
  12. int main(void) {
  13. printf( "mae: %s\n", s );
  14. shift_string( s );
  15. printf( "ato: %s\n", s );
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
mae: 0123456789
ato: 1234567890