[英]How to copy value from an array and assign it to another array in c?
In python i will do like 在Python中,我会喜欢
grid = [['a','b','c'],['d','e','f'],['g','h','i']]
another_grid = [['a','a','a'],['d','e','f'],['g','h','i']]
another_grid[0][1] = grid[1][1]
Above code will change 'a' to 'e' . 上面的代码会将'a'更改为'e' 。 How to do this in c ?
如何在c中执行此操作?
It's the same, even the syntax is similar: 相同,甚至语法相似:
char grid[3][3] = { { 'a', 'b', 'c' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } };
char another[3][3] = { { 'a', 'a', 'a' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } };
another[0][1] = grid[1][1];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.