I managed to pull off a few neat things in C that I was thinking about last night when comparing C++ to assembly. What are some cool things you like to do in C?


#include

void printsomething(){
printf("I am using a pointer to call this function\n");
}



typedef struct{
void(*printsomethingnew)();
}P_Class;

void get_somethingnew(){ printf("I am part of an object in C :D \n"); }




int main(){
//Using a pointer to call a function
void (*foo)() = &printsomething;
(*foo)();

//OOP in C
P_Class  DR_Class;
DR_Class.printsomethingnew = &get_somethingnew;
(*DR_Class.printsomethingnew)();
}