Memset is C and its allocating a block of memory to the heap.
sys_malloc is a predefine in gamestudio. malloc and new is supposably slower and is to C what sys_malloc is to gamestudio. You can click and read the description in gamestudio. Explains it better then I can.
Basically you are creating a pointer to your struct. Then your allocating a block of dynamic memory to hold the data that is stored in your struct and now that it's safely tucked away in memory you can save it with game_save.
Here is actual code from my game and yes it is this easy.
typedef struct PLR
{
var p_STR; //Roll 3D6
var p_CON; //Roll 3D6
var p_DEX; //Roll 3D6
var p_SIZ; //Roll 2D6
var p_INT; //Roll 2D6 + 6
var p_POW; //Roll 3D6
var p_CHA; //Roll 3D6
var p_PHY; //Roll 3d6
}PLR;
PLR* plr;//create a pointer variable called plr used in game_load() see main.
//make stat struct saveable
function p_save_struct()//create a function that will dynamically hold the contents of PLR struct.
{
PLR* new = sys_malloc(sizeof(PLR));//create a pointer variable called new(call it whatever you want), get the size of PLR struct and point to it.
memset(new,0,sizeof(PLR));//allocate memory for it on the heap. Remember there is stack and heap?
add_struct(new,sizeof(PLR));//add the size of the struct PLR to add_struct, making it game_save() saveable.
return new;//now return the value of new so that p_save_struct is worth something
}
void main()
{
plr = p_save_struct();
}