示例:
//Visual Studio中加上这句才可以使用scanf() //否则只能使用scanf_s() #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdbool.h> void mikado(int); //argc: 参数个数 argv[]: 参数数组 int main(int argc, char *argv[]) { int pooh = 2, bah = 5; printf("In main(), pooh = %d and &pooh = %p\n", pooh, &pooh); printf("In main(), bah = %d and &bah = %p\n", bah, &bah); mikado(pooh); system("pause"); return 0; } void mikado(int bah) { int pooh = 10; printf("In mikado(), pooh = %d and &pooh = %p\n", pooh, &pooh); printf("In mikado(), bah = %d and &bah = %p\n", bah, &bah); }
运行测试