ecco il codice sto compilando con gcc -Wall -o name name.c
#include <stdio.h>
#include <stdlib.h>
int *vettore; // vettore globale
vettore = (int *) malloc(1048576 * sizeof(int));
void funz(void);{
for(i=0; i<1048576; i++){
*(vettore+i)=1;
printf("\nvetto[%d]=%d",i,*(vettore+i));
}
//free(vettore);
}
int main(int argc, char **argv){
funz();
return 0;
}
errori:
prova1.c:5: warning: data definition has no type or storage class
prova1.c:5: warning: type defaults to ‘int’ in declaration of ‘vettore’
prova1.c:5: error: conflicting types for ‘vettore’
prova1.c:4: error: previous declaration of ‘vettore’ was here
prova1.c:5: warning: initialization makes integer from pointer without a cast
prova1.c:5: error: initializer element is not constant
prova1.c:7: error: expected identifier or ‘(’ before ‘{’ token