C语言输出字符,字符串的ASCII码的16进制数
/*
file name : test.c
cmd code : gcc -o test.exe test.c
*/
#include<stdio.h>
#include<string.h>
void main()
{
char ch[] = {'a','d','c','d'};//数组ch[]的实际长度为 5
//printf("%d\n", strlen(ch));
for(int i = 0; i<(int)strlen(ch)-1; i++){
printf("%c = 0x%x\n", *(ch + i), *(ch + i));
}
}