passing 2-Dimensional Array to a function

S

seemanta dutta

greetings C gurus,

I would be grateful if I could know the answers to 2 questions:

1. I want to know how to pass a 2-dimensional array to a function, say
foo() and what will be its prototype declaration?


2. Is there any difference between the name of a 2-dimensional char
array and a 'pointer-to-a pointer-to-a-char' in other words, is the
following true?

char array[5][10], **ptr ;
ptr = array ;


actual examples of code or links to code using 2-dimensional arrays
passed to functions will be highly appreciated.


thanks in advance...
yours sicerely,
seemanta dutta ;-)
 
E

Eric Sosman

seemanta said:
greetings C gurus,

I would be grateful if I could know the answers to 2 questions:

1. I want to know how to pass a 2-dimensional array to a function, say
foo() and what will be its prototype declaration?

2. Is there any difference between the name of a 2-dimensional char
array and a 'pointer-to-a pointer-to-a-char' in other words, is the
following true?

char array[5][10], **ptr ;
ptr = array ;

actual examples of code or links to code using 2-dimensional arrays
passed to functions will be highly appreciated.

Recommended reading: Section 6 "Arrays and Pointers"
in the comp.lang.c Frequently Asked Questions (FAQ) list

http://www.eskimo.com/~scs/C-faq/top.html

The explanations therein are terse, but perhaps the
clearest I've come across.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top