- 课堂交流区
- 帖子详情
746
回复
-
<p>可行。C语言的字符对应ASCII码</p>添加评论
-
<p>可行,字符有对应的ASCII码值</p>添加评论
-
相当于ascll添加评论
-
可以吧,相当于对应的int。添加评论
-
<p>可以的</p><p><br ></p>添加评论
-
<p>可以</p>添加评论
-
<p>可以</p>添加评论
-
<p>可以</p>添加评论
-
<p>可行,转换成对应ASCII码值的下标了。</p><p><code class="brush:cpp;toolbar:false" >#include <stdio.h> int main() { int a[256]; for ( int i = 0; i < 256; i++ ) { a[i] = 4; } printf("%d\n", a[65]); // 4 a['A'] = 8; printf("%d\n", a[65]); // 8 return 0; }</code></p>添加评论
-
可以的,会自动将其转化为对应的ASC码的值吧添加评论
-
<p>可以的,会自动将其转化为对应的ASC码的值</p>添加评论
-
<p>It's perfectly valid to use values of character type as array indices. An array index can be of any integer type; char<br >, unsigned char<br >, and signed char<br > are all integer types.</p><p>But plain char<br > can be either signed or unsigned, depending on the implementation. Either it has the same range as signed char<br >, or it has the same range as unsigned char<br >; either way, it's still a distinct type.</p><p>So if you have an array with 256 elements, you can safely index it with unsigned char<br >, which has a range of at least 0 to 255. You can't safely index it with char<br >, since it could have negative values.</p><p>Then, I casted it to an unsigned char, but that didn't work either. I ended up getting boundary issues there as well.</p><p>I can't help with that without more information.</p><p><br ></p>添加评论
-
<p>可以的,会自动将其转化为对应的ASC码的值</p>添加评论
-
<p>可以 </p>添加评论
点击加载更多
到底啦~