c里的迭代
struct node
{
int x;
struct node * next ;
};
typedef struct node pnode;
void main ()
{
pnode * curr,*head;
int i;
head NULL;
.....
while(curr)
{
printf("%d\n",curr->x);
curr=curr->next;
}
}
-------------------:-------------------
struct node
{
int x;
struct node * next ;
};
typedef struct node pnode;
void main ()
{
pnode * curr,*head;
int i;
head NULL;
.....
while(curr)
{
printf("%d\n",curr->x);
curr=curr->next;
}
}
-------------------:-------------------
0040106A mov [ebp+var_8],0
00401071 mov [ebp+var_C],1
00401071 mov [ebp+var_C],1
.........
004010B1 loc_4010B1:
004010B1 cmp [ebp+var_4],0
004010B7 mov eax,[ebp+var_4]
004010BA mov eax,[eax]
004010BC mov [esp+18h+var_14],eax
004010C0 mov [esp+18h+var_18],offset aD;"%d\n"
004010C7 call printf
004010CC mov eax,[ebp+var_4]
004010CF mov eax,[eax+4]
004010D2 mov [ebp+var_4],eax
004010D5 jmp short loc_4010B1
004010B1 loc_4010B1:
004010B1 cmp [ebp+var_4],0
004010B7 mov eax,[ebp+var_4]
004010BA mov eax,[eax]
004010BC mov [esp+18h+var_14],eax
004010C0 mov [esp+18h+var_18],offset aD;"%d\n"
004010C7 call printf
004010CC mov eax,[ebp+var_4]
004010CF mov eax,[eax+4]
004010D2 mov [ebp+var_4],eax
004010D5 jmp short loc_4010B1