J++) { answer[len*i+j] = my_string[j]; For (int i = 0; Also, '\0', which indicates the end of the string, was added to the last index of the answer after the loop ended.
Aedan Rayne Telegraph
[Programmer Coding Test] Converting lv.0 character list to string Next Post Given the string my_string and the integer k, please write a solution function that returns a string that repeats my_string k times. The problem itself is simply to copy and output my_string repeated an integer k times in the assigned answer.
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> // The string given as a parameter is given as const.
I want to multiply the string * by i times, but printf (* * i); doesn't work? Problem DescriptionGiven the string my_string and the integer k, please write a solution function that returns a string that repeats my_string k times. Restrictions 1 ≤ length of my_string ≤ 100my_string. There is a way to do this, but I also looked at other people's code and came up with a new function. I++) { for (int j = 0;
The correct answer posted by someone else is also the same. The problem requires writing a function that repeats the input string my_string an integer k times and outputs it. Given the problem string my_string and the integer k, please write a solution function that returns a string that repeats my_string k times. Solution #include #include #include // As a parameter.