I have a C linux function which has the following code:
void A (char *s1, char *s2)
{
...
*s2 = NULL;
...
}
in this function I put values into s2, and at the end put NULL.
the code:
*s2 = NULL
generates the following warning:
assignment makes integer from pointer without a cast
I want to fix my code, how can I do that?
thanks
Your system appears to have
NULLdefined as something like(void *)0. That means your assignment is doing just what the warning says – making an integer from a pointer without a cast. You don’t want to putNULLinto acharvariable anyway – you are probably looking for: