Question: Consider the following type definition: typedef struct funcs int (topenit) (char *name, int prot); void (closeit) (void); ) funcs; Write a C program called prog2.c

 Consider the following type definition: typedef struct funcs int (topenit) (char

Consider the following type definition: typedef struct funcs int (topenit) (char *name, int prot); void ("closeit) (void); ) funcs; Write a C program called prog2.c that includes simple C functions my openit (and my closeit that match the types of the function pointers in the structure definition above. The functions don't have to do anything complex inserting a single printf statement in the body is sufficient. You should also write function prototypes for your functions. (6) Now declare a variable of type funcs and statically initialize the fields openit and closeit with the addresses of your open and close functions. (c) Now illustrate the initialization of the fields of a variable of type funcs using a C function f) e.g., using (&var_of_type_funcs). Use the following command under Linux to compile your program. $ gcc -Wall -o prog2 prog2.c You should receive no warnings

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!