Hi i'm pretty new to C and am writing a program for a sports league table. I'm having a couple of problems:

I have the following code in a function to add a new team to an array of structs called teams (teams[i].name where i is next free array space):

Code:
void addTeam(char *teamName, int i)
{
	strcpy(teams[i].name, teamName);
}
this code semi works. It works fine if the name i enter has no spaces (eg. ManUtd) However if i enter Man Utd it places Man in teams[i].name and it places Utd in teams[i+1].name for some reason. Any ideas why?

Secondly I have made a function to try and sort an array of structs. I pass in the array of structs of type team, "teams". I call it as follows:

sortTable(teams);

Here is the code:

Code:
void sortTable(team teams)
{
	team temp[1];

	for (int i = 0; i < 12; i++)
	{
		for (int j = 11; j >=0; j--)
		{
			if (teams[j].score > teams[(j-1)].score)
			{ 	
				temp[1] = teams[(j-1)];
				teams[(j-1)] = teams[j];
				teams[j] = temp[1];
			}	
		} 
	}
}
Upon compiling i get the following errors:

"In this statement, "teams" is of type "pointer to struct declared without a tag", and cannot be converted to "struct declared without a tag". noconvert "(on the line when i am calling sortTable outside the function)

Secondly I get 6 errors saying "In this statement, "teams" has a struct type, but occurs in a context that requires a pointer. <needpointer>" (pointing to different lines of the code)

A lot of questions I know but I'm pretty lost here. Any help greatly appreciated.

Thanks