Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main() {
- char * s = calloc(1,sizeof(char));
- int i,j;
- for (i=1; i<=3; i++) {
- for(j=1; j<=i; j++) {
- //s = realloc(s, (strlen(s)+1) * sizeof (char));
- int t;
- for (t = strlen(s); t >= 0; t--) {
- s[t+1] = s[t];
- }
- s[0] = j+'0';
- }
- }
- printf("%s\n", s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement