How do I return a variable size string from a function?
问题 I need a working code for a function that will return a random string with a random length. What I want to do would be better described by the following code. char *getRandomString() { char word[random-length]; // ...instructions that will fill word with random characters. return word; } void main() { char *string = getRandomString(); printf("Random string is: %s\n", string); } For this, I am strictly forbidden to use any other include than stdio.h . Edit: This project will be adapted to be