You expect the code in swap() be able to access the struct numbers fields, but the full declaration of this type is inside main() , so it is not visible.
Ad break, it should be available to everyone who needs it. At the beginning, this will also eliminate the need for a preliminary declaration of the structure.
The same with swap() , placing it before main() will remove the need to have a prototype for it in the same file.
It should be:
struct numbers { . . . } static void swap(struct numbers *s) { . . . } int main(void) { . . . }
source share