字符数组优雅遍历

#include <iostream>

int main(){
  const char *options[] = { "test1", "test2", "test1", "test2", NULL };
  int i = 0;
  while(options[i]){
    std::cout<<options[i]<<std::endl;
    i++;
  }

  return 0;

}

猜你喜欢

转载自www.cnblogs.com/youge-OneSQL/p/9565843.html
今日推荐