好吧,在凯斯的帮助下,我完成了这件事。以下是我的测试代码和完成此问题的结果:
我的测试代码:#include
int test(unsigned char *test, int size){
int i;
for(i=0;i
printf("item %d in test = %d\n",i, test[i]);
}
}
int testout(unsigned char *test, int *size){
test[2]=237;
test[3]=12;
test[4]=222;
*size = 5;
}
main () {
test("hello", 5);
unsigned char hello[] = "hi";
int size=0;
int i;
testout(hello,&size);
for(i=0;i
printf("item %d in hello = %d\n",i, hello[i]);
}
}
我创建了一个main来测试我的c函数。下面是函数测试的输出:item 0 in test = 104
item 1 in test = 101
item 2 in test = 108
item 3 in test = 108
item 4 in test = 111
item 0 in hello = 104
item 1 in hello =