c – manipulating a structure

The problem must be in another area of ​​the code, apparently the attribute seems to be set correctly. I assume your problem is different, but to answer the question simply use the "." (Dot) to access the desired item and the assignment operator "=" to assign the value.

Of course you need to create a "variable" to assign the actual value of a player in memory, in my case p1.

Here is an example:

#include 

using namespace std;

struct dataplayer {int life; int fitting; int weapon; int level};

int main ()
{
cout << "define life  n";

// your player
Data layer p1;

p1.life = 100;

cout << p1.vida;

Return 0;
}

You can test this code here:

https://www.onlinegdb.com/online_c++_compiler

Note: I too am not clear and I am tired. If you encode in c or c ++, I recommend you to choose one.