Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main() {
  6. char * s = calloc(1,sizeof(char));
  7. int i,j;
  8. for (i=1; i<=3; i++) {
  9. for(j=1; j<=i; j++) {
  10. //s = realloc(s, (strlen(s)+1) * sizeof (char));
  11. int t;
  12. for (t = strlen(s); t >= 0; t--) {
  13. s[t+1] = s[t];
  14. }
  15. s[0] = j+'0';
  16. }
  17. }
  18. printf("%s\n", s);
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement