   how do you pass arrays to a function?
  Hi there....I am trying to pass arrays to a function... i know I can prob do the same thing with a class but I think it is better to start small... I am very new to programming... only 8 days with a book....anyway I am trying to make a function void testUserInput (vector <string> &words, short IndexWords[], short recogWords[], int search_index = 0, int WordslistIndex = 0 )void testUserInput (vector <string> &words, short IndexWords[], short recogWords[], int search_index, int WordslistIndex);What am i doing wrong here? I can not seam to get this to work?(c++)   
  Perhaps you should explain what you are trying to do with these functions or post an example how you're trying to use them. I don't see any mistake in the declarations you posted.What you basically need to know is that when you are passing an array as an argument, you are actually passing a pointer to the first element. Thus,void myFunc(int myArray[])is equivalent tovoid myFunc(int* myArray)andmyFunc(myArray);is equivalent tomyFunc(&(myArray[0]));Of course, this also means that you can use the [] indexing syntax on normal pointers, which of yourse you shouldn't do.This also means that arrays are always passed by reference rather than by value (if you don't know what this means, look it up); i.e. if you modify the array in the function, the original array will be modified, too.   ;  Since you already use std::vector for your strings, why not use them for the shorts as well? That saves you all the trouble of messing with C-style arrays.Tom;  It is important to note that when passing an array using the methods randomZ mentioned, you have to also pass the length of the array.   ;  Please post the error messages you got.However, why have you posted 2 function interfaces? Do you use both (what shouldn't work due to ambiguousness)?   