電脳ミツバチのコンピュータ広報室

銀座の屋上菜園を耕しています。コンピュータ畑も耕します。

関数

②関数のポインタと構造体を使ったプログラム

少し難しいが非常に有用なプログラム。 #include<stdio.h> #include<string.h> int list(void) { printf("func list\n"); return 1; } int show(void) { printf("fanc show\n"); return 1; } int quit(void) { exit(0); } struct command{ char *com_str; int (*com_func)(void)</string.h></stdio.h>…

①関数

関数を理解するには何といってもスタック(メモリ)の動作である。 詳しくはスタックの項にあるが、 void B(int b,int c) { int d=4; } void A(void) { int a=1; B(2,3); } このような関数を呼び出したときに | | | | | | |4 |d |復帰情報 |2 |b …