ios Byte *bt 输出 输出指针对应的内容 怼烎@ 2022-09-24 07:23 146阅读 0赞 Byte \*bt 将指针bt所指的内容,输出打印出来 # 1、初始化、赋值 Byte \*bt # Byte \*bt= (Byte\*)malloc(3); pb\[0\]=1; pb\[1\]=2; pb\[2\]= 3; # 2. 打印输入 Byte \*bt # ## 方法一: ## int size = 3; //前提是 知道指针/bt\* 所指内容的长度,否则用方法二 for (int i=0; i<size; i++) \{ NSLog(@"i==%d value==%d",i,bt\[i\]); \} ## 方法二: ## Byte \*p ; p=bt; while(p!=nil) \{ p++; NSLog(@"i==%d value==%d",i,\*p); \}
还没有评论,来说两句吧...