C
c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char *newstr;
char addstr[] = "Hello";
int i;
int addcnt = 5;
int newsize = strlen(addstr)*addcnt+addcnt;
newstr = (char *)malloc(newsize);
for(i=0; i<addcnt; i++) {
if(i==0) strcpy(newstr,addstr);
else strcat(newstr, addstr);
if(i<addcnt-1) strcat(newstr," ");
}
printf("%s\n",newstr);
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run