Proszę o pomoc, mam wypełnić funkcję fill_in mając do dyspozycji te dwie struktury.
Wykorzystując struktury cell_information oraz information_carrier wypełnij ciało funkcji
void fill_in(cell_info_ptr data, unsigned int id, float sq,
info_carrier_ptr carr_ptr)
która przypisuje wartości parametrów „id”, „sq” i „carr_ptr” do pól „identifier”,
„signal_quality” i „carrier_ptr” zmiennej strukturalnej „data”.
Nie wiem czy idę w dobrym kierunku, mam też wątpliwości co do argumentów, z którymi mam wywołać funkcję.
#define SIZE 100
/* Information about the cell */
struct cell_information
{
char name[SIZE]; /* Cell name */
unsigned int identifier; /* Cell identifier */
float signal_quality; /* Signal Quality (between 0 and 100) */
struct information_carrier *carrier_ptr; /* Pointer to a second structure */
};
typedef struct cell_information cell_info; /* Synonym for the structure */
typedef struct cell_information *cell_info_ptr; /* Synonym for the pointer to struct */
/* Information about the carrier */
struct information_carrier
{
char name[SIZE]; /* String with the carrier name */
unsigned int priority; /* Priority of the connection */
unsigned int last_checked; /* Last time it was checked*/
};
typedef struct information_carrier info_carrier; /* Synonym for the structure */
typedef struct information_carrier *info_carrier_ptr; /* Synonym for the pointer */
void fill_in(cell_info_ptr data, unsigned int id, float sq, info_carrier_ptr carr_ptr)
{
data->identifier=id;
data->signal_quality=sq;
data->carrier_ptr=carr_ptr;
}
int main(){
fill_in(cell_info_ptr *obiekt,10,20,info_carrier_ptr* obiekt2);
}