#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> #define COUNT (10) void printf_nodes(int*buf) { int i = 0; if(buf==NULL) { printf("buf is NULL "); return; } for(i=0 ;buf[i]!='?';i++) { printf("buf[%d] is %d ",i,buf[i]); } } //0-8 ? int main() { int* buf = (int*)malloc(COUNT*sizeof(int)); buf[0] = 0; buf[1] = 1; buf[2] = 2; buf[3] = 3; buf[4] = 4; buf[5] = 5; buf[6] = 6; buf[7] = 7; buf[8] = 8; buf[9] = '?'; printf_nodes(buf); free(buf); for(;;); return 0; }