#8 build_menu returns user_inf struct?

Aperto
aperto 4 anni fa da stevet · 0 commenti
Steve Thielemann ha commentato 4 anni fa

In cpp, I think it would be better written as:

void build_menu(user_inf &my)

Pass the my variable by reference. Meaning, it can be directly modified by the function.

In c, you would defined the function as user_inf * my, and my->metal, etc. to access and change the values.

As this is, you're letting the compiler handle the copying of the structure. (Did you intend for copying to be going on?)

In cpp, I think it would be better written as: ```c void build_menu(user_inf &my) ``` Pass the __my__ variable by reference. Meaning, it can be directly modified by the function. In c, you would defined the function as user_inf * my, and my->metal, etc. to access and change the values. As this is, you're letting the compiler handle the copying of the structure. (Did you intend for copying to be going on?)
Sign in to join this conversation.
Nessuna milestone
Nessun assegnatario
1 Partecipanti
Caricamento...
Annulla
Salva
Non ci sono ancora contenuti.