srupのメモ帳

競プロで解いた問題や勉強したことを記録していくメモ帳

2019-04-28から1日間の記事一覧

main()の前後で関数を呼び出す

GCCの拡張機能を使って行っています. #include <stdio.h> __attribute__((constructor)) void foo() { printf("hello, before main\n"); } __attribute__((destructor)) void bar() { printf("hello, after main\n"); } int main(int argc, char const *argv[]) { pri</stdio.h>…