In a new file called
using_structs_and_unions.c
, write a program
with these features:
An structure called struct survey_information
which stores
the name of a person and a field which stores
the street of the person if this person lives in Leganés, or the district
if the person does not live in Leganés.
Hint: You will need a field to know if the person lives in Leganés
or does not.
Function void data_enter(struct survey_information *ptr_survey):
This function initializes the name field of the structure
addressed by ptr
(remember, no more than 30 chars).
Then, it will set if the person is or is not from Leganés,
initializing the Leganés address if the first case, or
the district he or she comes from if the second case.
Function void data_display(struct survey_information *survey):
This function prints the name of the user
and the address if he or she is a Leganés citizen,
or their district otherwise.
Implement a main
function that first gets the data from the user and, second,
prints the data on the screen, with the help of the previous two functions.