Wypełnienie funkcji fill_in mając do dyspozycji dwie struktury

0

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);
	
} 
0
typedef struct cell_information *cell_info_ptr;
typedef struct information_carrier *info_carrier_ptr;

Czy to jest okey (nawet dla C++) ? przecież cell_info* czy info_carrier* jest krótkie i jasne.

0

Niestety, taki kod otrzymałem - mam tylko uzupełnić funkcję fill_in.

1
int main()
  {
    info_carrier ic;
    cell_info ci;
    fill_in(&ci,10,20,&ic); 
    return 0;
  }
0

Dziękuję za pomoc w wypłenieniu maina, program teraz się kompiluje. Chciałem zapytać jeszcze czy funkcja fill_in na pewno została przeze mnie poprawnie wypełniona?

0

nie, bo nie wypełnione pole char name[SIZE];

1 użytkowników online, w tym zalogowanych: 0, gości: 1