How can I declare and define multiple variables in one line using C++?

后端 未结 10 1750
抹茶落季
抹茶落季 2020-11-27 11:09

I always though that if I declare these three variables that they will all have the value 0

int column, row, index = 0;

Bu

10条回答
  •  孤街浪徒
    2020-11-27 12:01

    I wouldn't recommend this, but if you're really into it being one line and only writing 0 once, you can also do this:

    int row, column, index = row = column = 0;
    

提交回复
热议问题