I'm working on a function that prints all the array elements that are between 2 values in the array. I keep getting these errors in my function call and I dont know why since I declared them in the prototype. I'm a bit shaky when it comes to deal with arrays in functions. The for loop I have going to print the elements in between the 2 values looks very dry and of course is not done. Do i have to pass in an array as a parameter because I'm working with an array? ugg, this is so frustrating. Thank you for your time.
Code:#include <iostream> using namespace std; void print (int x,int y );//prototype int main() { const int size=10; int a[size]={1,2,3,4,5,6,7,8,9,10}; cout<<"The elements printed are"<<print(x,y);//call return 0; } void print(int x, int y) //print out all elements between 2 given parameters { for (int i=x; i<y; i++) //not done cout<<i; }



LinkBack URL
About LinkBacks


