Code:
/* First, define the structure outside functions.
** Just the definition, I'm not talking about variables (objects)
** of the structure at this time */
struct hello {
int goodbye;
int evening;
};
/* now the prototype, using pointers to the structure */
void function(struct hello *);
/* The main() function */
int main(void) {
struct hello hello = {1}; /* initialization; all unmentioned members are initialized to 0 */
hello.evening = 42; /* assignment ot a specific member */
function(&hello); /* call the function */
return 0;
}
void function(struct hello *p) {
printf("%d\n", p->goodbye);
}