Looks like i didn’t recall correctly … the code below which i copied from an online tutorial and slightly amended – the c compiler does warn of incompatibility when calling the function the second time with the incorrect structure type.
So, that’s great. that’s basically what i wanted although, better if it doesnt compile at all.
I guess in C++ this wouldn’t compile due to incompatible types.
Btw, the complied code executes and prints garbage for the second call.
/* added this */
void func(struct student *record);
struct student record;
record.percentage = 86.5;
struct moo rmoo;
rmoo.percentage = 86.5;
void func(struct student *record)
printf(" Id is: %d \n", record->id);
printf(" Name is: %s \n", record->name);
printf(" Percentage is: %f \n", record->percentage);