如何使用C ++在一行中声明和定义多个变量? [英] How can I declare and define multiple variables in one line using C++?

查看:2028
本文介绍了如何使用C ++在一行中声明和定义多个变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是这样,如果我声明这三个变量,他们都将具有值0

int column, row, index = 0;

但我发现只有索引等于0&其他是像844553&

But I find that only index equals zero & the others are junk like 844553 & 2423445.

如何将所有这些变量初始化为零,而不必在新行上声明每个变量?

How can I initialise all these variables to zero without declaring each variable on a new line?

推荐答案

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

这篇关于如何使用C ++在一行中声明和定义多个变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆