Correzione Verifica
Es 11
#include <stdio.h>
void Modifica(int y){
y+=5;
}
int main()
{
int x=8;
Modifica(x);
printf("%d\n",x);
return 0;
}
Es 11 modificato
#include <stdio.h>
int y=0;
void Modifica(int y){
y+=5;
printf("%d\n",y);
}
int main()
{
y=8;
Modifica(y);
printf("%d\n",y);
system("pause");
return 0;
}
Es 12
#include <stdio.h>
void varia(int a,int b){
a=a+6;
b=b+8;
}
int main()
{
int x=0;
int y=0;
varia(x,y);
printf("%d \n%d",x,y);
return 0;
}
Esercizio su Array
#include <stdio.h>
int a[4][4]={{-2,6,5,0},{-2,4,7,0},{-9,7,2,3},{-7,1,2,0},};
void stampaArray(){
int i,j;
for(i=0;i<4;i++){
for(j=0;j<4;j++){
printf("%d ",a[i][j]);
}
printf("\n");
}
}
int main()
{
stampaArray();
system("PAUSE");
return 0;
}
Commenti
Posta un commento