Repeat a string n times with the character c between | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Repeat a string n times with the character c between

I want my output is "all right, all right, all right". Could someone have for a look to my code below where is wrong? Thanks https://code.sololearn.com/c8DSPjkjpDIT/#c

22nd Oct 2018, 11:20 PM
Tuyen Pham
Tuyen Pham - avatar
2 Answers
+ 1
you returned the pointer to the local variable which can't be used by the main function, while returning pointers return those from the main function or global variables, I have corrected your function to take output string pointer as an argument. https://code.sololearn.com/cR5z0gy7cAtv/?ref=app
23rd Oct 2018, 2:25 AM
Gaurav Atreya
Gaurav Atreya - avatar
+ 1
thanks for your help =))
23rd Oct 2018, 4:27 AM
Tuyen Pham
Tuyen Pham - avatar