I need to multiply the string by the number entered by the user.
For example, if he enters "hello" and he types 3, it must show hellohellohello
int multStr() {
char string;
int multiply = 0;
int j;
printf("enter a string please");
scanf("%s", & string);
printf("now multiply your string");
scanf("%d", & multiply);
for (j = 0; multiply == !j; ++j) {
printf("%s", string);
}
}
But nothing is printed out, can i please get help?
Hey you got some bugs:
char string[100];//change to pointer
scanf("%s", &string);change this to --->gets_s(string,100)
for (j = 0; multiply>j; ++j)//change the condition
Hope this helped you and good luck later
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.