Home > Back-end >  Consult bosses
Consult bosses

Time:03-28

#include
#include
Typedef struct player
{
Char name [20].
Int life;
Int fight;
Int equipnumber;


} player;
Void namechange (player * w1, char new [])
{

Strcpy (w1 - & gt; The name of the new [5]);

}

Void lifec (player * w1, int step)
{

W1 - & gt; Life +=step;
}
Void fightc (player * w1, int add)
{

W1 - & gt; Fight +=add;
}
Void equipnumberc (player * w1, int number)
{
W1 - & gt; Equipnumber +=number;
}
Void showplayer (player * w1)
{
Printf (" nickname: % s \ n life value: % d \ n: % d \ n number of equipment: % d \ n ",
W1 - & gt; The name,
W1 - & gt; Life,
W1 - & gt; Fight,
W1 - & gt; Equipnumber);

}


Int main ()
{
Player mingwang;
Player * w1;
W1=& amp; Mingwang;
Strcpy (w1 - & gt; The name, "mingwang");
W1 - & gt; Life=5000;
W1 - & gt; Fight=250;
W1 - & gt; Equipnumber=45;
Showplayer (w1);
Namechange (w1, "");
Equipnumberc (w1, 1);
Fightc (w1, 500);
Showplayer (w1);

}






Bosses can help me have a look at what's the problem, the second is the function of main function calls when prompt indirect level is different, different parameter and argument types
  • Related