Home > Back-end >  The structure of the body
The structure of the body

Time:12-23

//programs fill in the blanks, don't change related to the input and output statements,
//give a structure type, internal member account and password,
//before that use this structure to define a variable, and the variable assignment, store the account and password information,
//in memory unit cutting for this data structure, in bytes, and into the buf array, write a program to restore the structure data and output,
# include "stdio.h"
Struct config_type
{
Char account_number [10].//account
Unsigned long long PSW.//password
};
Struct config_type user;
Int main ()
{
//the original structure variable data
Unsigned char buf []={x4e x5a 0, 0 x4b, 0, 0 x55, 0 x0, 0 x0, 0 x0, 0 x0, 0 x0, 0 x0, 0 x0, 0 x0,
0 x0, 0 x0, 0 x0, 0 x0, 0 xe, 0 xaa, 0 xf6, 0 x9c, 0 x2, 0 x0, 0 x0, 0 x0};
int i;
Unsigned char * p=(unsigned char *) & amp; The user;


/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */

Puts (user. Account_number);
Printf (" % LLD \ n ", the user. The PSW);
return 0;
}

CodePudding user response:

Cast direct:

Buf user=* (struct config_type *);
  • Related