如何使用指针将2D数组传递给Cfunction? [英] How To Pass a 2D array to a Cfunction using Pointers?

查看:70
本文介绍了如何使用指针将2D数组传递给Cfunction?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用数组,函数和指针时遇到了问题。请告诉我使用Pointers将2 D数组传递给C函数。当我编译这样的程序时,我收到错误说功能需要一个如果我给了原型,那么它也会给出一个错误,比如无法将int转换成int *或类似的东西。如果需要我可以发布我遇到问题的特定程序。请帮助我out!

I have got a problem using Arrays,Functions and Pointers together.Please tell me hoe to pass a 2 D Array to a C function using Pointers.When I compile such a Program,I get an error saying "Function needs a prototype".If I give the protype ,then also it gives an error like,"Cannot convert int into int* "or something like that.If needed I can post the particular program with which i had the problem.Please help me out !

推荐答案


我在使用数组,函数和指针时遇到问题。请告诉我锄头通过使用Pointers将二维数组转换为C函数。当我编译这样的程序时,我收到一条错误,上面写着函数需要一个原型。如果我给出了原型,那么它也会给出一个错误,如无法转换为int进入int *或类似的东西。如果需要我可以发布我遇到问题的特定程序。请帮帮我!
I have got a problem using Arrays,Functions and Pointers together.Please tell me hoe to pass a 2 D Array to a C function using Pointers.When I compile such a Program,I get an error saying "Function needs a prototype".If I give the protype ,then also it gives an error like,"Cannot convert int into int* "or something like that.If needed I can post the particular program with which i had the problem.Please help me out !





您无需丢弃整个代码。

发布您声明的原型以及如何你打电话给它。

Raghuram

Hi,
You need not ost the entire code.
Post the prototypw you have declared and how are u calling it.
Raghuram


我宣称的原型是:


void display(int *, int,int);


函数调用如下:


display(a,3,4);


函数定义如下:


void display(int * q,int row,int col)

{

}




The prototype I had declared was :

void display(int *,int,int);

The function call is as follows :

display(a,3,4);

The function definition is as follows:

void display(int *q,int row,int col)
{
}









你不需要输入整个代码。

发布你宣布的原型,你怎么称呼它。

Raghuram
Hi,
You need not ost the entire code.
Post the prototypw you have declared and how are u calling it.
Raghuram



我声明的原型是:


void display(int * ,int,int);


函数调用如下:


display(a,3,4);


函数定义如下:


void display(int * q,int row,int col)

$

}
The prototype I had declared was :

void display(int *,int,int);

The function call is as follows :

display(a,3,4);

The function definition is as follows:

void display(int *q,int row,int col)
{
}



i认为显示功能是一个二维数组。

如果是是你的原型/定义你已宣布不会工作的情况。

你必须改变calloing部分只传递一个维度到这个功能

检查这个

i think a in display function is a 2-d array.
If that is the case then the prototype/definition u have declared wont work.
U have to change the calloing part to pass only one dimension to this function
check this

展开 | 选择 | Wrap | 行号


这篇关于如何使用指针将2D数组传递给Cfunction?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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