Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
#include "avr/io.h" main() { unsigned char= z ; for(z=0;z<200;z++) PORTA=z; //PORTA dispalys the value of z }
请解释循环的工作,因为 z 是 char 并且充当 int
char(并且通过扩展,unsigned char)是一个整数类型。Anunsigned char可以保存从 0 到 255 的值。
char
unsigned char
字符通常也存储在char变量中。他们实际存储的是相关字符的 ASCII 值。例如:
char c = 'A';
该变量c包含值 65,即 的 ASCII 值A。
c
A
在此代码的情况下,unsigned char变量正在整数上下文中使用。