The problem is in how you are passing the array to the function. You'll have to let the function know that the array is two-dimensional -
Code:
#include <iostream>
#include <cstring>
using std::cout;
using std::cin;
using std::endl;
//declare variables
char string[16] = "";
//function prototypes
int LookFor(char[] [16], char*);
//functions
int main()
{
char office[11][16] = {{"Pen"},{"Chalk"},{"Biro"},{"Crayon"},{"Ruler"},{"Eraser"},{"Stapler"},{"Paper"},{"Whiteout"},{"Glue"},{"Pencil"}};
cout << endl << "Enter the string you wish to find: ";
cin.getline(string, 16, '\n');
LookFor(office, string); //call function
return 0;
}
int LookFor(char office[][16], char *string)
{
int x = 0;
while (x < 11)
{
if(stricmp(office[x], string) == 0)
{
cout << "Found string: " << string << ", in" << " Row: " << x << endl;
return 1;
}
else
{
x++;
}
}
return -1;
}
Also you may want to give your array (string) another name as if you want to use the newer c++ libraries giving your variable the name 'string' prevents the 'using namspace std;' shortcut as your name conflicts with the c++ string class.