"Semantic problem: implicitly declare a library function" malloc "with type" void * (unsigned long) "

I have a block of code where I try to grab an expression inside parentheses and then use it. At the moment when the code below starts, I'm in the middle of iteration through an array of characters, and pcc- a pointer to the current character, which was defined as '('. My goal is to put a parathetic expression into an array of characters pe.

            int nnrp = 1; /* Net number of right parantheses */
            char * pbpe = pcc; /* Pointer to the beginning paranthetical expression */
            for (++pcc; *pcc!= '\0' && nnrp != 0; ++pcc)
            {
                if (*pcc == '(')
                {
                    ++nnrp;
                }
                else if (*pcc == ')')
                {
                    --nnrp;
                }
                else if (*pcc == '\0')
                {
                    sprintf(err, "Unbalanced paranthesis");
                    return -1;
                }
            }
            /* If we're here, *pcc is the closing paranathesis of *pbpe */
            long nel = pcc - pbpe; /* New expression length */
            if (nel == 1)
            {
                sprintf(err, "Empty parenthesis");
                return -1;
            }
            char * pe = (char*)malloc(nel+1); /* Paranthetical expression */
            strncpy(pcc+1, pcc, nel);
            pe[nel] = '\0';

But my IDE (Xcode 6.0) gives me a warning

"Semantic problem: implicitly declares a library function 'malloc' of type 'void * (unsigned long)'"

in line strncpy(pcc+1, pcc, nel);. I'm interested

  • why am I getting this warning.
  • Do I need to fix it.
  • - , .

.

+4
1

:

#include <stdlib.h>

malloc, .

, , stdlib.h . malloc, . , , , , , , , . , .

+19

All Articles