What you’re looking for is reflection. Java and other virtual languages has reflection so you can print out the variable names and function names for any given class. Because the compiler builds these reflection functions automatically.
C does not have reflection. You must do everything manually.