Hello,
can anyone tell me how to pass an array to a function ?
I have this function , part of my class.
It works if I do not put in int a[i] everywhere , but obviously , I need to
add an array so I can keep everything neat and tidy, And to call the array
whenever I want
thanks
kenny
void Setting::SetCyl inder(int r, int h, int s, int a[i])
{
int value;
for (int i=0; i<count; i++)
{
cout<<" Enter a time: " <<endl;
cin>> value;
a[i].hours = value;
cout<<" Enter a minute: " <<endl;
cin>> value;
a[i].minutes = value;
cout<<" Enter a second: " <<endl;
cin>> value;
a[i].seconds = value;
}
}
can anyone tell me how to pass an array to a function ?
I have this function , part of my class.
It works if I do not put in int a[i] everywhere , but obviously , I need to
add an array so I can keep everything neat and tidy, And to call the array
whenever I want
thanks
kenny
void Setting::SetCyl inder(int r, int h, int s, int a[i])
{
int value;
for (int i=0; i<count; i++)
{
cout<<" Enter a time: " <<endl;
cin>> value;
a[i].hours = value;
cout<<" Enter a minute: " <<endl;
cin>> value;
a[i].minutes = value;
cout<<" Enter a second: " <<endl;
cin>> value;
a[i].seconds = value;
}
}
Comment