如何在C中显示输出时获取链表索引?

时间:2011-11-17 08:16:47

标签: c++ c visual-c++ syntax

是否可以在opencv中输出结果之前放置链表索引? 例如,我有代码

for( ; i!= 0; i= i->h_next )
    {
    printf("Index number = %d   Area = %.2f \n",n, area); 
    }

现在,我的问题是,如何打印这个索引号?由于i的值不在1,2,3等等......

1 个答案:

答案 0 :(得分:2)

也许试试:

int cnt = 0;
for ( .. ) {
    printf("%d\n", cnt++);
}
相关问题