指针参数的DEMO
#include <stdio.h>
void hex_printf(char* buf, int buf_len)
{
int i = 0;
if (NULL == buf)
{
return;
}
printf("len is : %d \n", buf_len);
printf("str_array is: %s \n", buf);
for (i = 0; i < buf_len; i++)
{
printf("0x%02x \n", buf[i]);
}
printf("\n");
}
int main()
{
char data[] = "test";
int dataSize = 4;
hex_printf(data, dataSize);
}
out:
len is : 4
str_array is: test
0x74
0x65
0x73
0x74
封装指针参数
typedef struct {
unsigned char* data;
int dataSize;
}vc_input_info;
typedef struct {
unsigned char* data;
int dataSize;
}vc_output_info;
标签:示例,int,len,C语言,char,printf,dataSize,buf,指针
From: https://www.cnblogs.com/mysticbinary/p/17167585.html