私はこのコードを持っています:
#include <stdio.h>
void sample(int b[3])
{
//access the elements present in a[counter].
for(int i=0;i<3;i++)
printf("elements of a array are%d\n",b[i]);
}
int main()
{
int count =3;
int a[count];
int i;
for(i=0;i<count;i++)
{
a[i]=4;
}
for(i=0;i<count;i++)
{
printf("array has %d\n",a[i]);
}
sample(//pass the array a[count]);
}
main()
この関数のパラメーターとして渡すことにより、外部のユーザー定義関数でこのメイン関数で宣言された配列にアクセスしたいと思います。これどうやってするの?