Today, when writing data to parse post data using C, we need to use an array variable to put all the post data waiting for resolution. We don't want to waste too much memory. So I want to apply for an array with the maximum content_length. However, variables are not allowed. For example
Int length = atoi (getenv ("content_length"); </P> <p> char Params [length]; </P> <p> memset (Params, '/0', length); <br/>
Char Params [length] is not compiled (in my understanding, the system determines the size of Params during compilation, and length is not a definite value, even if length is defined as a number, the system still does not know it, so it is not allowed to be defined in the standard, but I just guess the reason)
Modify it to the following:
Int length = atoi (getenv ("content_length"); </P> <p> char * Params = malloc (length * sizeof (char )); </P> <p> memset (Params, '/0', length); <br/>