Ragazzi ho il seguente codice:
Quando compilo ho il seguente errore:codice:#include "stdafx.h" #include <stdio.h> #define N 4 typedef void (*IntInInt) (int, int); void exchange_sort(int *A, IntInInt scambio); void stampa(int *A); int _tmain(int argc, _TCHAR* argv[]) { int A[N]={4, 3, 2, 1}; exchange_sort(A, scambio); stampa(A); return 0; } void scambio(int a, int b){ int temp; temp=a; a=b; b=temp; } void exchange_sort(int *A, IntInInt scambio){ int j; bool swap=false; while (swap){ for (j=0; j<N-2; j++){ if (A[j]>A[j+1]){ scambio(A[j], A[j+1]); swap=true; } } } } void stampa(int *A){ int i; for (i=0; i<N; i++){ printf("%d ", A[i]); } }
Ma non riesco a capire cosa sbaglio.codice:error C2065: 'scambio': identificatore non dichiarato

Rispondi quotando