#include <stdio.h>
#include <assert.h>
#include <malloc.h>
static int N, *A;
void Report (int val){
assert(++result_n <= N);
printf("%d ", val);
}
void sort_even(int N, int *A) {
int i;
for (i = 0; i < N; i++) {
if (A[i] % 2 == 0) Report(A[i]);
}
}
int result_n;
int main(){
int i, tmp;
tmp = scanf("%d", &N);
assert(tmp == 1);
A = (int*) malloc( sizeof(int) * N );
for(i = 0; i < N; i++){
tmp = scanf("%d", &A[i]);
assert(tmp == 1);
}
sort_even(N, A);
return 0;
}
Compilation message
In file included from tutorial3.cpp:2:0:
tutorial3.cpp: In function 'void Report(int)':
tutorial3.cpp:7:11: error: 'result_n' was not declared in this scope
assert(++result_n <= N);
^