Here how i malloc memory
char *convertToPostfix(char **infixExpr)
{
char *postfixExpr = (char *) malloc(strlen(*infixExpr) * sizeof(char) * 2);
...
return postfixExpr;
}
Here how i use this memory:
char *subexpr = convertToPostfix(infixExpr);
free(subexpr);
while (*subexpr)
postfixExpr[i++]=*subexpr++;
Why does this program work normally after free(subexpr);
I mean why is it possible to iterate in while after freeing?
And am i doing everything right working in such way, when function returns some memory, which is freed in another context?