How's is this program working?

not sure what you mean by "alone". Of course the "." means element of a structure

a little awkward, but demonstrates what C is capable of. File is named main.c, compiled with cc and outputsf "Hello World".

#include <stdio.h>

void pr (const char *s) {
    printf (s);
};

typedef struct {
    void (*print) (const char *s);
} Serial_s;

Serial_s Serial = { pr };

int
main ()
{
    Serial.print ("Hello World\n");
    return 0;
}
1 Like