本帖最后由 jackz007 于 2024-10-20 17:35 编辑
只要编译、运行一下这个代码,你就可以发现,你说的没错:#include <stdio.h>
int main(void)
{
int i ;
char str[10] = {'5' , '6' , 'H'} ;
for(i = 0 ; i < 3 ; i ++) printf("%c\n" , str[i]) ;
for(; i < 10 ; i ++) printf("%d\n" , str[i]) ;
}
用 gcc 编译、运行的效果:D:\[exercise]\C>g++ -o x x.c
D:\[exercise]\C>x
5
6
H
0
0
0
0
0
0
0
D:\[exercise]\C>
用 VC19 编译、运行的效果:D:\[exercise]\C>cl x.c
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.31.31107 版
版权所有(C) Microsoft Corporation。保留所有权利。
x.c
Microsoft (R) Incremental Linker Version 14.31.31107.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:x.exe
x.obj
D:\[exercise]\C>x
5
6
H
0
0
0
0
0
0
0
D:\[exercise]\C>
|