如何一下子多维数组分配多个值后创造它 - 在C? [英] How to assign multiple values at once to multi-dimensional array AFTER creating it - in C?

查看:157
本文介绍了如何一下子多维数组分配多个值后创造它 - 在C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编程C和不知道是否有可能一次性分配多个值,一个多维数组?
我已经尝试了一些技术,但都失败了!
我不感兴趣遍历数组赋值(我要禁食的方式来分配新值阵列中的所有索引)。
我正在使用数组:ARY [4] [4]

I'm programming in C and wonder if it's possible to assign multiple values at once to a multi-dimensional array? I have tried some technique but all have failed! I’m NOT interested to loop through the array to assign values (I want the fasted way to assign new values to all index in the array). The array I’m working with: ary[4][4].

推荐答案

由于数组不是修改的左值,它不能出现在赋值的左侧。您可以初始化它,你可以通过索引分配个人会员。

Since an array is not a modifiable lvalue, it cannot appear on the left side of an assignment. You can initialize it and you can assign individual members via indexing.

6.3.2.1

一个作案网络能够左值是不具有数组类型的左值,
  不具有...

A modifiable lvalue is an lvalue that does not have array type, does not have ...

和可修改左值

名称''左值'从分配最初来
  前pression E1 = E2,其中左操作数E1的要求是一个
  (MODI网络能)左值。

The name ‘‘lvalue’’ comes originally from the assignment expression E1 = E2, in which the left operand E1 is required to be a (modifiable) lvalue.

所以,不,你不能做你想做的。

So no, you can't do what you want.

这篇关于如何一下子多维数组分配多个值后创造它 - 在C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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