C++ 如何在C中显示输出时获取链表索引?
是否可以在opencv中的结果输出之前放置一个链表索引? 例如,我有代码C++ 如何在C中显示输出时获取链表索引?,c++,c,visual-c++,syntax,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等中。可以尝试: int cnt = 0; for ( .. ) { printf("%d\n", cnt++); }
for( ; i!= 0; i= i->h_next )
{
printf("Index number = %d Area = %.2f \n",n, area);
}
现在,我的问题是,如何打印这个索引号?由于i
的值不在1、2、3等中。可以尝试:
int cnt = 0;
for ( .. ) {
printf("%d\n", cnt++);
}