返回一个指针的指针的函数 [英] Return a pointer to pointers in a function

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

问题描述

我有一个类的矩阵。该汇总表dinamically分配,我想封装它。

I have a matrix in one class. That matrix is allocated dinamically, I want to encapsulate it.

下面是在头文件我的矩阵声明:

Here is my matrix declaration in the Header file:

float** matrix;

这里是GET方法的声明:

And here is the declaration of get method:

float *getMatrix();

一切都正确为止?

Is everything correct so far?

我不知道如何在这种情况下,工作的指针。如何将get函数是什么样子?

I don't know how to work with pointers in that case. How would the get function look like?

推荐答案

如果你只想回到你应该使用矩阵

if you want just to return matrix you should use

float** getMatrix();

这篇关于返回一个指针的指针的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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