I am having trouble with the strncpy. Here's my current code for one of my functions that contains the errors:
Code:
#include <stdlib.h>
int extractFirst(char functionRead, char *plusPointer) {
char firstNumberString[600]="a;sdlkfasdf";
strncpy(firstNumberString, functionRead, plusPointer);
return 0;
}
These are the errors that I get when I compile with GCC:
Code:
dhaivat@DebianDesktop:~/Desktop/Math Engine$ clear
dhaivat@DebianDesktop:~/Desktop/Math Engine$ gcc main.c FunctionParser.c Add.c ExtractNumbers.c -o Math
ExtractNumbers.c: In function ‘extractFirst’:
ExtractNumbers.c:4: warning: incompatible implicit declaration of built-in function ‘strncpy’
ExtractNumbers.c:4: warning: passing argument 3 of ‘strncpy’ makes integer from pointer without a cast
dhaivat@DebianDesktop:~/Desktop/Math Engine$
I don't understand what is going wrong. I think I am using the function correctly, right?
Please help, Thanks.