nginx中C语言操作技巧学习
#pragma once #ifndef CLANGTEST_H__ #define CLANGTEST_H__ #define ngx_debug_init() #define NGINX_VERSION "1.17.7" #define NGINX_VER "nginx/" NGINX_VERSION #endif // !CLANGTEST_H__
#include<iostream> #include"ClangTest.h" static int ngx_test(); static int hello(); typedef int(*intPtr)(); intPtr num[] = { ngx_test }; int(*funArray[])() = {ngx_test,ngx_test, hello, ngx_test, hello, ngx_test, hello ,hello ,hello ,hello ,hello ,ngx_test ,ngx_test ,ngx_test ,ngx_test }; int main(int argc, char* argv[]) { using namespace std; ngx_debug_init(); cout << "hello world " << std::endl; cout << NGINX_VER << endl; for (int i = 0; i < sizeof(funArray) / sizeof(int(*)()); i++) { cout << funArray[i]() << std::endl; } system("pause"); return 0; } int ngx_test() { using std::cout; using std::endl; cout << "ngx_test" << endl; return 0; } static int hello() { using std::endl; using std::cout; cout << "Function test hello" << std::endl; return 5; }