- 相關推薦
c語言中用字符串數(shù)組寫菜單的代碼
以前寫菜單方面東西時往往重復, 發(fā)現(xiàn)這個方法還可以, 用一個指針的指針解決遍歷問題.
代碼如下所示:
復制代碼 代碼如下:
#include
static char *menu[] = {
"1 --- push one item./n",
"2 --- pop one item./n",
"3 --- quit./n",
NULL
};
void Show_menu();
int main()
{
Show_menu();
return 0;
}
void Show_menu()
{
char **p;
p = menu;
while(NULL != *p)
{
printf("%s", *p);
*p ++;
}
}
【c語言中用字符串數(shù)組寫菜單的代碼】相關文章:
C語言字符數(shù)組和字符串10-19
C語言字符串快速壓縮算法代碼09-05
C語言的數(shù)組與函數(shù)10-23
C語言數(shù)組教程08-31
什么是C語言數(shù)組10-03
C語言字符串07-24