返回二维数组的简单方法 [英] Simple method that returns a 2d array

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

问题描述

大家好.我正在用C ++写一个简单的rpg,并试图创建一个getMap函数,该函数返回2d字符数组.但是,我在寻找最佳方法方面遇到了一些麻烦.我认为最有效的方法是将poiner作为参数并用数组元素填充它,但是对于如何执行此操作一无所知.有人可以帮我们吗?

谢谢,

解决方案

看看此页面 [ ^ ] MSDN提供指导.但是,根据您的要求,您可能会发现最好使用一种STL类,例如地图 [ ^ ].

Hello guys. I am writing a simple rpg in c++ and am trying to create a getMap function which returns a 2d array of chars. however I am haveing a bit of trouble in finding the best way of doing this. I figured the most efficient way would be to take in a poiner as a parameter and fill it up with the array elements but am clueless as to how to do this. Could anyone give us a hand?

Thanks,

解决方案

Take a look at this page[^] in MSDN for guidance. However, depending on your requirements you may find it better to use one of the STL classes, such as map[^].


这篇关于返回二维数组的简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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