C Programming - My program is good enough for my assignment but I know its not good
- by Joe
Hi there
I'm just starting an assignment for uni and it's raised a question for me.
I don't understand how to return a string from a function without having a memory leak.
char* trim(char* line) {
int start = 0;
int end = strlen(line) - 1;
/* find the start position of the string */
while(isspace(line[start]) != 0) {
start++;
}
…