473,395 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to pass a two-dimension array to a function in C++??

I need pass a double-type two-dimension array to a function, I can not
figure out,please help.

Nov 14 '05 #1
2 1590
On Fri, 19 Nov 2004 00:15:58 -0500, ssss wrote:
I need pass a double-type two-dimension array to a function, I can not
figure out,please help.


This group discusses Standard C, not C++, hence the name comp.lang.c.
Please ask your question in comp.lang.c++.

Rob Gamble
Nov 14 '05 #2
ssss <sh***@wsu.edu> wrote:
I need pass a double-type two-dimension array to a function, I can not
figure out,please help.


#include <stdio.h>
#include <stdlib.h>

#define ROWS 31
#define COLUMNS 42

void gets_passed_2d_array( double x[ ][ COLUMNS ],
size_t nrows, size_t ncols );

int main( void )
{
double a[ ROWS ][ COLUMNS ];
size_t i, j;

for ( i = 0; i < ROWS; i++ )
for ( j = 0; j < COLUMNS; j++ )
a[ i ][ j ] = i * COLUMNS + j;

gets_passed_2d_array( a, ROWS, COLUMNS );
return EXIT_SUCCESS;
}

void gets_passed_2d_array( double x[ ][ COLUMNS ],
size_t nrows, size_t ncols )
{
size_t i, j;

for ( i = 0; i < nrows; i++ )
for ( j = 0; j < ncols; j++ )
printf( "x[ %lu ][ %lu ] = %f\n", ( unsigned long ) i,
( unsigned long ) j, x[ i ][ j ] );
}

Or what exactly are you looking for?
Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: HelLind | last post by:
Hello everyone ! Is there any way to pass session variables between two websites ( diff domains) ? I've two websites and I want to integrate them. I used to use the querystring but there is...
0
by: Raj | last post by:
hi, How to pass a Two Date parameter to a report at runtime using VB .NET 1. How do we pass multiple values eg. Startdate, EndDate to crystal reports parameter. 2. I have a report to...
3
by: Dthmtlgod | last post by:
I want to pass the value to two frames and two pages after hitting the submit button If my form I have this <form method="get" action="search2.asp" target="fSearch2"> I want to pass crPN to...
4
by: tom | last post by:
Hi Experts, I want to pass the selectedDate value from my calender form to another web form or a web user control. Could you please show me how to do this? Thanks in advance.
2
by: Alex Nitulescu | last post by:
Hi. I have tried to pass two parameters, like this: Response.Redirect(String.Format("NewPage.aspx?Username={0}, Pass={1}", txtUserName.Text, txtPass.Text)) But if I pass Username="Alex" and...
1
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then the new page is open in the same popup window as i...
5
by: oaktown | last post by:
Running two input forms on the same page, one php and the other (the one I would like to create) to be written in perl. The idea is to accept an input from a perl script, then pass that input to two...
5
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, Is there an easier way to handle that? I used Javascript to handle this when our two domains are hosted on two different servers(on different networks) and our search engine marketing...
24
by: =?Utf-8?B?U3dhcHB5?= | last post by:
Can anyone suggest me to pass more parameters other than two parameter for events like the following? Event: Onbutton_click(object sender, EventArgs e)" Event handler: button.Click += new...
21
by: raylopez99 | last post by:
In the otherwise excellent book C# 3.0 in a Nutshell by Albahari et al. (3rd edition) (highly recommended--it's packed with information, and is a desktop reference book) the following statement is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.