C语言,数组,急
#include<stdio.h>#define SIZE 5
void modifyArray(int[],int);
void modifyElement(int);
main()
{
int a[SIZE]={0,1,2,3,4};
int i;
printf("Effects of passing entire array callby reference:\n\nThe values of the original array are:\n");
for(i=0;i<=SIZE-1;i++)
printf("%3d\n",a[i]);
modifyArray(a,SIZE);
printf("The values of the modified array are:\n");
for(i=0;i<=SIZE-1;i++)
printf("%3d",a[i]);
printf("\n\n\nEffects of passing array element call by value:\n\nThe value of a[3] is %d\n",a[3]);
modifyElement(a[3]);
printf("The value of a[3] is %d\n",a[3]);
}
void modifyArray(int b[],int size)
{
int j;
for(j=0;j<=size-1;j++)
b[j]*=2;
}
void modifyElement(int w)
{
printf("%d",a[3]);
}
总通不过,
C:\microsoft_visualc6\myexample\k.c(37) : error C2065: 'a' : undeclared identifier
C:\microsoft_visualc6\myexample\k.c(37) : error C2109: subscript requires array or pointer type
Error executing cl.exe.
k.obj - 2 error(s), 0 warning(s)