a problem with array of char
Hi, all,
I have the following problem:
Code:
int read_line(char *buf) {
int max_size = findmaxsize();
char result[max_size];
// put some char into result
buf = result;
}
It seems that buf and result contain nothing. I must do it like the following to get correct output.
Code:
int read_line(char *buf) {
//int max_size = findmaxsize();
char result[1024];
// put some char into result
buf = result;
}
However i need the max_size, cos everytime this value changes. Can anyone help me to solve this problem? Thank you so much!