Ciao ragazzi,sto studiando i puntatori in C. Ho dichiarato il puntatore e ho assegnato un valore al puntatore, ma il compilatore mi da errore alla riga a=&n; aiutatemi, per favore.Grazie.
Io ho scritto:
codice:
int *a;
int n=4;
int *a;
a=&n;
printf("Il numero è %i\n" *a);
Riporto il log di compilazione:

codice:
Compilatore: Default compiler
Esecuzione di  gcc.exe...
gcc.exe "C:\Documents and Settings\Home\Desktop\puntatore.c" -o "nul"    -I"C:\Dev-Cpp\include"   -L"C:\Dev-Cpp\lib" 
C:\Documents and Settings\Home\Desktop\puntatore.c:4: error: conflicting types for 'a'
C:\Documents and Settings\Home\Desktop\puntatore.c:3: error: previous declaration of 'a' was here
C:\Documents and Settings\Home\Desktop\puntatore.c:4: warning: initialization makes integer from pointer without a cast
C:\Documents and Settings\Home\Desktop\puntatore.c:4: warning: data definition has no type or storage class
C:\Documents and Settings\Home\Desktop\puntatore.c:5: error: syntax error before string constant
C:\Documents and Settings\Home\Desktop\puntatore.c:5: warning: conflicting types for built-in function 'printf'
C:\Documents and Settings\Home\Desktop\puntatore.c:5: warning: data definition has no type or storage class

Esecuzione terminata