初始化二维字符数组 [英] Initialize 2d array of chars

查看:71
本文介绍了初始化二维字符数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此ode初始化字符的二维数组

Im trying to initialize 2d array of chars with this ode

int x=4;
int y=4;
char plg[x][y]={{"o","o","o","o"},{"o","o","o","o"},{"o","o","o","o"},{"o","o","o","o"}};

但是这段代码抛出错误 error:char数组初始化程序中的多余元素| 我搜索了一段时间,所有内容都说这是如何执行2d char数组的严格方法。为什么会引发错误?

but this piece of code throws error error: excess elements in char array initializer| i was searching for a while and everything says this is the rigth method how to do 2d char array. Why does it throw error?

推荐答案

"this is a string"

'o' /* this is a character */

这篇关于初始化二维字符数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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