指標陣列的應用場景之main函式

2021-07-04 08:39:44 字數 1854 閱讀 4404

#include "stdio.h"

#include "string.h"

#include "stdlib.h"

#include #include //演示:指標陣列的用法

//演示:找錯誤 注意return

//求關鍵字在表中的位置

//乙個入口 多個出口

int searchekeytable(const char* table, const int size, const char* key, int *pos)

//間接的證明 陣列做函式引數的退回

inum = (sizeof(table)/sizeof(*table));

for(i=0; i帶引數的巨集

//searchekeytable( c_keyword, (sizeof(c_keyword)/sizeof(*c_keyword)),"do", &pos);

//searchekeytable( c_keyword, inum,"do", &pos);

printf("pos:%d\n", pos);

//searchekeytable(null, dim(c_keyword),"do", &pos);

//printf("pos:%d\n", pos);

searchekeytable( c_keyword, dim(c_keyword), "static", &pos);

printf("pos:%d\n", pos);

system("pause");

return ;

}//main函式是作業系統呼叫的函式

//在程式執行的時候可以向main函式傳遞引數

/*argc 命令列引數

argv 命令列引數陣列

env 函式變數陣列

int main();

int main(int argc);

int main(int argc, char *argv)

*/int main477(int argc, char* argv, char**env)

// for(i=0; argv[i]!=null; i++)

//

printf("******************* end argv *******************\n");

printf("\n");

printf("\n");

printf("\n");

printf("******************* begin env *******************\n");

for(i=0; env[i]!=null; i++) //

printf("******************* end env*******************\n");

getchar();

}void main()

; char* c_keyword2 = ;

char* c_keyword3 = ;

for (i=0; c_keyword[i] != null; i++)

printf("\n....\n");

for (i=0; c_keyword2[i] != null; i++)

printf("\n....\n");

for (i=0; c_keyword3[i] != null; i++)

system("pause");

}int main45()

; // null 0 '\0'

for(i=0; c_keyword[i]!=null; i++)

system("pause");

}

指標陣列的應用場景

1.做選單 define crt secure no warnings include include include 求關鍵字在表中的位置 乙個入口,多個出口 void searchkeytable const char table,const int size,const char key,in...

應用場景之 區別篇

是否存在區別 is dir 存在資料夾,返回true if file 存在檔案,返回true file exists is dir is file 可以判斷目錄存在.和檔案存在 執行效率非常低 類是否存在 class exists 方法是否存在function exists 存在就把時區傳遞過去,先...

SAP BTP MTA 應用的應用場景

程式語言 軟體設計架構 如微服務 協議 如 odata 的最新趨勢和進展,以及多層和分布式部署平台的多樣性,加速了由更多 更小 解耦和多樣化的模組構建應用程式的趨勢。在微服務架構下,越來越多的業務應用程式傾向於由使用不同語言和技術開發並部署到各種目標執行時環境的多個部分組成。這種應用程式模組的多樣性...