#define FOR while(x--) int x=3,y=0; FOR {y++; } printf("x=%d,y=%d",x,y);为什么x=-1,y=3呢?x等于0时,循环不就停止了吗?
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/05 12:36:53
![#define FOR while(x--) int x=3,y=0; FOR {y++; } printf(](/uploads/image/z/11914363-19-3.jpg?t=%23define+FOR+while%28x--%29+int+x%3D3%2Cy%3D0%3B+FOR+%7By%2B%2B%3B+%7D+printf%28%22x%3D%25d%2Cy%3D%25d%22%2Cx%2Cy%29%3B%E4%B8%BA%E4%BB%80%E4%B9%88x%3D-1%2Cy%3D3%E5%91%A2%3Fx%E7%AD%89%E4%BA%8E0%E6%97%B6%2C%E5%BE%AA%E7%8E%AF%E4%B8%8D%E5%B0%B1%E5%81%9C%E6%AD%A2%E4%BA%86%E5%90%97%3F)
#define FOR while(x--) int x=3,y=0; FOR {y++; } printf("x=%d,y=%d",x,y);为什么x=-1,y=3呢?x等于0时,循环不就停止了吗?
#define FOR while(x--) int x=3,y=0; FOR {y++; } printf("x=%d,y=%d",x,y);为什么x=-1,y=3呢?
x等于0时,循环不就停止了吗?
#define FOR while(x--) int x=3,y=0; FOR {y++; } printf("x=%d,y=%d",x,y);为什么x=-1,y=3呢?x等于0时,循环不就停止了吗?
宏在编译的时候,会直接替换为代码,展开之后如下:
int x=3,y=0; while(x--){ y++;}
printf("x=%d,y=%d",x,y);
while(x--)中,先进行判断操作,后进行--操作,但是即使x==0时,while(x)为假,注意这时还有一次x--操作
综上所述,while循环有3次,x--有4次,故答案为x=-1,y=3
#define FOR while(x--) int x=3,y=0; FOR {y++; } printf(x=%d,y=%d,x,y);为什么x=-1,y=3呢?x等于0时,循环不就停止了吗?
新手求解这个程序的意思,#include #define uint unsigned int#define uchar unsigned char uchar a,b,temp,table[]={0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7}; void delay(uint z){ uint x,y; for(x=z;x>0;x--)for(y=110;y>0;y--); }void main(){ while(1) { te
void delayms(uint j){uchar i;for(;j>0;j--){i=250;while(--i);i=249;while(--i);}有几个宏定义忘记写了,现在补上.#define uchar unsigned char#define uint unsigned int#define out P2
这个宏是什么意思#define st(x) do { x } while (__LINE__ == -1)zstack中进入退出临界区的宏定义是#define HAL_ENTER_CRITICAL_SECTION(x) st( x = EA; HAL_DISABLE_INTERRUPTS(); )#define HAL_EXIT_CRITICAL_SECTION(x) st( EA = x; )其中st(
求每一步的解释 意义#pragma argsused#define C(x,y) xo##y#define FOR(x) for(C(a,x)=1;C(a,x)
#define s(x) 3
#define S(x) 3
define fun(x,
#define configASSERT( x )
#define min(x,y) (x
#define MIN(x,y)(x)
#define __T(x) L ## x
#define get2byte(x) ((x)[0]
#define
关于定积分~错哪儿了?急~# include # define N 100# define F(x) (x)*(x)*(x)float sab(float a,float b){ float h,sum=0; scanf(%f%f,&a,&b); h=(b-a)/N; for(;a
#define SETBIT(x,y) (x|=(1
#define MEM_B( x ) ( *( (byte *) (x) ) 我看不懂
#define get_u8(X,O) (*(u8 *)(((u8 *)X) +