You are trying to group the code according to structure. Group by file. You put all functions and internal variables in the header or header and the ".o" file of the object compiled from the source file c.
There is no need to reinvent object orientation from scratch for a C program that is not an object oriented language.
I have seen this before. This is strange. Some coders have an aversion to passing the object they want to change into a function to change it, although this is the standard way to do this.
I blame C ++ because it hid the fact that the class object is always the first parameter in a member function, but it is hidden. So it looks like it is not passing an object to a function, even if it is.
Client.addClient(Client& c);
C is flexible and can accept transfer things by reference.
The C function often returns only a status byte or int, and this is often ignored. In your case, the correct form may be
err = addClient( container_t cnt, client_t c); if ( err != 0 ) { fprintf(stderr, "could not add client (%d) \n", err );
addClient will be in Client.h or Client.c
Chris Reid Jun 14 '17 at 7:41 2017-06-14 07:41
source share