I have seen some programmers code looking as below
Where after they have declared a struct they have two similar function pointing to the struct
What is the porpouse of the first void Point_print(const struct screen* self);
when below of the main function there is another void Point_print(const struct screen* self);
doing all the expressions
struct screen{
double x;
double y;
};
void Point_print(const struct screen* self); // <-- what is the purpose of having this function?
int main(int argc, const char * argv[]) {
struct screen aScreen;
aScreen.x = 1.0;
aScreen.y = 2.0;
Point_print(&aScreen);
return 0;
}
void Point_print(const struct screen * self){ // <-- this function is doing the work?
printf("x:%f, y:%f",(*self).x,(*self).y);
}