I have the following c code:
#include<stdio.h>
int main(void)
{
char buff[10];
memset(buff,0,sizeof(buff));
gets(buff);
printf("\n The buffer entered is [%s]\n",buff);
return 0;
}
When I run the code, I get the following warning:
warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
Add
#include <string.h>
at the top of file.
This because is the header file where the memset prototype can be found by compiler.
Avoid using gets function... Use scanf or fgets instead.
Take a look HERE