Hi!
It is clear that when we try to pass a one dimentional array to a
function
we use int* such as
void display(int *LocalAarray)
{
......
}
int main(void)
{
int MainArray[3] = {1, 2, 3};
display(MainArray);
return 0;
}
name of the array is automaticly casted to (int*)
but what is the case I want to use two dimensional array ?
int main(void)
{
int MainArray[2][3] = {{1, 2, 3},
{4,5,6}};
display(MainArray);
return 0;
}
what should be the formal parameter of display function?
void display(int** Local Array) ? <-- Is it true? 6 1742 er****@gmail.com wrote: Hi! It is clear that when we try to pass a one dimentional array to a function we use int* such as
void display(int *LocalAarray) { ...... }
int main(void) { int MainArray[3] = {1, 2, 3};
display(MainArray); return 0; } name of the array is automaticly casted to (int*) but what is the case I want to use two dimensional array ? int main(void) { int MainArray[2][3] = {{1, 2, 3}, {4,5,6}};
display(MainArray);
return 0; }
what should be the formal parameter of display function? void display(int** Local Array) ? <-- Is it true?
That's a good question, which is why the answer is in the FAQ: http://www.eskimo.com/~scs/C-faq/q6.18.html
Read the rest of it while you're there, it's good stuff.
S. er****@gmail.com wrote: Hi! It is clear that when we try to pass a one dimentional array to a function we use int* such as
void display(int *LocalAarray) { ...... }
int main(void) { int MainArray[3] = {1, 2, 3};
display(MainArray); return 0; } name of the array is automaticly casted
"converted" is a more better word to use than "casted", there.
to (int*) but what is the case I want to use two dimensional array ? int main(void) { int MainArray[2][3] = {{1, 2, 3}, {4,5,6}};
display(MainArray);
return 0; }
what should be the formal parameter of display function? void display(int** Local Array) ? <-- Is it true?
void display(int (*Local_Array)[3]);
--
pete
haroon wrote: Skarmander wrote: [snip]
That's a good question, which is why the answer is in the FAQ: http://www.eskimo.com/~scs/C-faq/q6.18.html
who is responsible for this FAQ and what is the frequency of update?
Steve Summit (sc*@eskimo.com) is the one responsible, and the last
update was on July 3, 2004 (this is the version posted monthly to the ng
and available through anonymous FTP at rtfm.mit.edu). Search Usenet
archives like Google's for the skinny.
S.
haroon wrote: Skarmander wrote: [snip]
That's a good question, which is why the answer is in the FAQ: http://www.eskimo.com/~scs/C-faq/q6.18.html
who is responsible for this FAQ and what is the frequency of update?
Read the FAQ.
True, it only answers one of your questions completely.
But it gives a pretty good hint about the other, and I don't
think you deserve a more complete answer until you've given
some tiny indication that you're willing to expend two or
three of your own mouse clicks in pursuit of knowledge. You've
been served a URL on a silver platter; can you eat it yourself,
or do you need servants to lift each morsel to your lips, or
maybe even chew it for you?
--
Eric Sosman es*****@acm-dot-org.invalid
Skarmander <in*****@dontmailme.com> writes: haroon wrote: Skarmander wrote: [snip]
That's a good question, which is why the answer is in the FAQ: http://www.eskimo.com/~scs/C-faq/q6.18.html who is responsible for this FAQ and what is the frequency of update? Steve Summit (sc*@eskimo.com) is the one responsible, and the last update was on July 3, 2004 (this is the version posted monthly to the ng and available through anonymous FTP at rtfm.mit.edu). Search Usenet archives like Google's for the skinny.
A more up-to-date version, in gzipped text format, is at
<ftp://ftp.eskimo.com/u/s/scs/C-faq/faq.gz>. The HTML pages don't
appear to have been updated since 1995.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alex Vinokur |
last post by:
Various forms of argument passing
=================================
C/C++ Performance Tests
=======================
Using C/C++ Program Perfometer...
|
by: Gil |
last post by:
Can anyone see why I'm getting an error with the following code :
void NewData::store(NewDataStruct nd, unsigned long& NewDataID)
{
OtherData.store(nd, NewDataID); // error in this line
//...
|
by: Steven T. Hatton |
last post by:
This may seem like such a simple question, I should be embarrassed to ask
it. The FAQ says an object is "A region of storage with associated
semantics." OK, what exactly is meant by "associated...
|
by: Mark Dicken |
last post by:
Hi All
I have found the following Microsoft Technet 'Q'
Article :-
Q210368 -ACC2000: How to Pass an Array as an Argument to a Procedure
(I've also copied and pasted the whole contents into...
|
by: erktek |
last post by:
Hi!
It is clear that when we try to pass a one dimentional array to a
function
we use int* such as
void display(int *LocalAarray)
{
......
}
|
by: Roy Smith |
last post by:
I've got some legacy code I'm maintaining. There's a method declared in
the class.h file like this:
void foo(unsigned priority);
and it's implemented as:
void myClass::foo (unsigned /*...
|
by: assgar |
last post by:
Hi
I thought I had resolved this problem but I am intermittently
the receving the warnings below.
This code consist of a 1) HTML form, 2) a display function on the HTML form and
3) a...
|
by: bowlderster |
last post by:
Hello,all.
I want to get the array size in a function, and the array is an argument of the function.
I try the following code.
/***************************************
*/
#include<stdio.h>...
|
by: Klaas Vantournhout |
last post by:
Hi all,
I was wondering if it is possible if you can check in a function if one
of the arguments is temporary.
What I mean is the following. A is a class, foo is a function returning
a class...
|
by: =?Utf-8?B?RGF2aWQgTGV2aW5l?= |
last post by:
This is really more of a "why was C# designed this way?" type of question.
Hope this is the write forum for this question. Given the following :
class Base1
{
public int i;
}
struct Base2...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |