#include <stdio.h> #include <stdlib.h> #include <limits.h> #include <time.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> #include <signal.h> #include <string.h> #include <stdlib.h> // 字符数组的传参 里面会通过\0来区分 void mybufshow(char*pbuf) { int i; for(i=0;i<strlen(pbuf);i++) { printf("pbuf is %c\n",pbuf[i]); } // printf("sizeof pbuf is %d\n",sizeof(pbuf)); // printf("sizeof pbuf[0] is %d\n",sizeof(pbuf[0])); } // 整形数组 #if 0 void mydatashow(int*buf) { int i ; #if 0 for(i=0;i<sizeof(buf)/sizeof(buf[0]);i++) { printf("buf is %d\n",buf[i]); } #endif // p = 4 buf[0] = 4 } #endif // 0 void mydatashow(int*buf,int n) { int i ; for(i=0;i<n;i++) { printf("buf is %d\n",buf[i]); } } int main() { char buf[125] = {0}; int data[100] = {1,2,3,4,5,6,7,8,9}; sprintf(buf,"hello"); printf("buf is %s\n",buf); mybufshow(buf); mydatashow(data,10); for(;;); return 0; }