#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> // 字符数组的传参 里面会通过 来区分 void mybufshow(char*pbuf) { int i; for(i=0;i<strlen(pbuf);i++) { printf("pbuf is %c ",pbuf[i]); } // printf("sizeof pbuf is %d ",sizeof(pbuf)); // printf("sizeof pbuf[0] is %d ",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 ",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 ",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 ",buf); mybufshow(buf); mydatashow(data,10); for(;;); return 0; }