Hey guys, I need help with this one. I'm writing a really basic program that will generate a character array firstName[amount][size]. using this it will then pass it to the function addPerson and that will modify the value.
Here's my current code
void deletePerson(int &, int, char[], char[], char[], char[]);
int main()
{
char firstNames[100][25], lastNames[100][25], email[100][50], phone[100][16];
else if (userChoice == 'D')
{
deletePerson(count, amount, &firstNames,&lastNames,&email,&phone);
}
}
void deletePerson(int count, int amount, firstNames&, lastNames&,email&,phone&);
{
//blahblahblah
}
I know that it's wrong and pardon my newbieness. I had it working to a point where it only had on error but then i decided to change everything. Anyway, I hope you get the point of what i'm trying to say. Basically i Need to pass the array and have it modified inside the function. How might i go about that?
Thanks!
edit: Ok so i can't use global variables either, that'd be too easy.
I edited the code to get rid of the &. it gives me
error LNK2019: unresolved external symbol "void __cdecl deletePerson(int &,int,char (* const)[25],char (* const)[25],char (* const)[50],char (* const)[16])" (?deletePerson@@YAXAAHHQAY0BJ@D1QAY0DC@DQAY0BA@D@Z) referenced in function _main
my new code looks like
void deletePerson(int &, int, char[][25], char[][25], char[][50], char[][16]);
int main()
{
char firstNames[100][25], lastNames[100][25], email[100][50], phone[100][16];
else if (userChoice == 'D')
{
deletePerson(count, amount, firstNames,lastNames,email,phone);
}
}
void deletePerson(int count, int amount, char firstNames[100][25], char lastNames[100][25],char email[100][50],char phone[100][16])
{
int position; //the place where the person is in the array
position = searchName(count, amount, lastNames);
if (position != -1)
{
}
}
void deletePerson(int &, int, char[][25], char[][25], char[][50], char[][16]), but does not define it. It does define a completely unrelated(!) function with signaturevoid deletePerson(int, int, char[100][25], char[100][25],char[100][50],char[100][16]), which is unused. Make sure to use exactly the same signature for declaration and definition.