0
나는이 같은 경고는 무엇입니까 아래의 코드를 컴파일 할 경우는 memset 함수 경고를 제거 할 필요
경고 : 내장 함수 memset 함수의 호환되지 않는 암시 적 선언을 [기본적으로 활성화]
void transform(int **a, int m, int n)
{
int *row = malloc(m*sizeof(int));
int *col = malloc(n*sizeof(int));
memset(row, 0, sizeof(row));
memset(col, 0, sizeof(col));
[...]
당신이에 대한 함수 프로토 타입을 볼 수 컴파일러의 순서를
#include <string.h>
이 필요하다는
$ man memset
MEMSET(3) BSD Library Functions Manual MEMSET(3)
NAME
memset -- fill a byte string with a byte value
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <string.h>
^^^^^^^^^^^^^^^^^^^
이 당신을 알려줍니다
'의를 sizeof (행) '플랫폼에 무엇이든 포인터 크기 -
참고 또한 당신의 코드에서 버그가 있음을 변경해야합니다. 나는. 32 비트 env .. 4보다 정확한 것은'memset (raw, 0, m * sizeof (int))'일 것이다 - 단지 참고 : – artapet
'p = malloc (x * y)'다음에'memset (p, 0, x * y)'는'p = calloc (x, y)'에 대한 하나의 호출과 같습니다. – alk
[컴파일러 오류 :이 범위에서 memset이 선언되지 않았습니다.] (http://stackoverflow.com/questions/2505365/compiler-error-memset-was-not-declared-in-this-scope) 가능한 복제본. 사실, 나는 [함수 memset의 컴파일러 경고 암시 적 선언을 해결하는 방법] (http://stackoverflow.com/questions/2144617/how-to-resolve-compiler-warning-implicit-declaration-of-function-memset)을 의미했습니다. – Antonio