字符数组优雅遍历

#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;

}

 

posted @ 2018-08-31 14:57  友哥  阅读(166)  评论(0编辑  收藏  举报