One day, you are be assigned a task to write the program for bank. In this task, you are required to write two function below:
func1 : AccountData* createData(char* name, int money);
func2 : AccountData* userQuery(AccountData* data);
func1 help bank to store user's data and func2 help bank to return a copy data to user (In order to avoid user directly modify the money information in bank)
The bank give you a simple data struct to implement above two function.
typedef struct _AccountData {
char* name;
int money;
} AccountData;
main.c
function.h
note that: you can use strlen(const char* str) in string.h to get the length of string
hint: you should not directly assign name to data->name, you need to malloc some memory space to copy the name's value.
data->name = name (x)
S N M
S: the username (2 < length(username) < 100)
N: the money in the bank
M: the number which user try to modify.
Output the current money in the bank and other information. (if user try to modify the money in bank then output warning information otherwise output "query finish")