Okay. This weeks 'problem' is that I need to simulate a game. I have to make two singly linked lists which will contain a name of player, his attack (double/float) number and his defence number and so on for as many players as the user inputs. The point of the game is to try to break the other 'chain'. You do that by running into 'enemies' chain and trying to break it, you break it if your attack is greater then defence of two players that you are trying to separete. If you separate them you can pick one of them to join your chain, but if you don't break it you stay in place where you tried to break chain.
So, I need to program two lists with all those atributes and I don't have an issue with creating a
typedef struct player {
int atc,def;
struct player *next;
} Player;
but how do I add the name of the payers ? Can I so it with
while((string = getchar()) != '\n'){
name[i++] = string ;
}
? And then pass the string -name- to first element of linked list ?
If you don't get something that I wrote, please don't hesitate to ask!(sorry for bad spelling)