hi,
I came across this code online on a tutorial site. This part of the code confused me.
What confused me was the local variables declared ouside the opening brace of the function definition. I have also seen such code before once but thought it was a typo. But obviously this is a valid syntax. Can someone clear this for me please.Code:/* * parse--split the command in buf into * individual arguments. */ parse(buf, args) char *buf; char **args; { while (*buf != NULL) { /* * Strip whitespace. Use nulls, so * that the previous argument is terminated * automatically. */ while ((*buf == ' ') || (*buf == '\t')) *buf++ = NULL; /* * Save the argument. */ *args++ = buf; /* * Skip over the argument. */ while ((*buf != NULL) && (*buf != ' ') && (*buf != '\t')) buf++; } *args = NULL; }
-Livin