submission.c: In function ‘collision’:
submission.c:12:3: error: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
if (board[i] == board[k] || (abs(board[i] - board[k]) == abs(i - k)) )
^
submission.c: In function ‘main’:
submission.c:32:2: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘unsigned int *’ [-Wformat=]
scanf("%d", &C);
^
submission.c:32:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
submission.c:35:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
^
VS2015와 ideone으로 테스트했을땐 오류가없는데
답변제출을하면 저런 오류를 뱉습니다
math함수가 제대로 include안되어 abs함수가 안불러지는것같은데
다른 분들이 쓴걸보면 math함수를 씀에도 잘 되고 scanf부분도 큰문제는 없는것 같은데
제가 어떤부분에서 틀린지좀 여쭤봅니다
샹아바
submission.c: In function ‘collision’:
submission.c:12:3: error: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
if (board[i] == board[k] || (abs(board[i] - board[k]) == abs(i - k)) )
^
submission.c: In function ‘main’:
submission.c:32:2: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘unsigned int *’ [-Wformat=]
scanf("%d", &C);
^
submission.c:32:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
submission.c:35:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
^
VS2015와 ideone으로 테스트했을땐 오류가없는데
답변제출을하면 저런 오류를 뱉습니다
math함수가 제대로 include안되어 abs함수가 안불러지는것같은데
다른 분들이 쓴걸보면 math함수를 씀에도 잘 되고 scanf부분도 큰문제는 없는것 같은데
제가 어떤부분에서 틀린지좀 여쭤봅니다
8년 전