C2601

Hey Guys any help on this problem would be most appreciated. It keeps returning the error C2601 which is:

Error 1 error C2601: 'getData' : local function definitions are illegal c:\users\joe mcdermott\desktop\programing resit work\amateur football league\amateur football league\amateur football league.cpp 14 Amateur Football League


Here is my code:


I'm just not sure exactly where im going wrong with it. thanks guys
would help if you had the code lol



#include <iostream>
#include <string>
using namespace std;
#define MAX 4
#define LENGH 20

void getData (char s[MAX][LENGH]);
int main()
{
char people[MAX][LENGH];


void getData(char s[MAX][LENGH])
{


int loop;

for (loop = 0; loop < MAX; loop++)
{
cout << "Enter Team Names: " << endl;
cin.getline(s[loop],20);
}
}
}
please disregard this part:

char people[MAX][LENGH];
You can't put a funciton in another funciton. Move getData so it's outside of main:

1
2
3
4
5
6
7
8
9
void getData(char s[MAX][LENGH])
{
  // .. getData stuff here
}

int main()
{
  // .. main stuff here
}


PS. please please please start using code tags
Topic archived. No new replies allowed.