IPB

Welcome Guest ( Log In | Register )

> Using Multidimensional Arrays In Functions
bongo
post Feb 9 2010, 12:00 PM
Post #1


Regular
*

Group: EstablishedMember
Posts: 31
Joined: 27-January 03
Member No.: 171



i have a multidimensional array, or let's say an array of string, that i would like to use in a function.
i tried ma make an exemple:

unsigned char myarray[15][6];

these are 6 strings of the lenght of 15 characters. right?

now i want to give this to a function by reference:

PrintMyArray(myarray);



the function itself is defined as:

CODE
void PrintMyArray(unsigned char *thearray) {

  for (unsigned char i=0; i<6;i++) {
    printF(thearray[i];
  }
}



unfortunately, this does not work.
what do i have to do to give an array to function?

thanx!
update Picpack 3.0 Released
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
Reynard
post Feb 10 2010, 07:01 PM
Post #2


Super Enthusiast
***

Group: EstablishedMember
Posts: 429
Joined: 24-October 07
From: Scotland
Member No.: 3,861



Pavel,

So why does my example not compile with BoostC but it does with another PIC compiler.

Cheers

Reynard
Go to the top of the page
 
+Quote Post
Pavel
post Feb 10 2010, 10:22 PM
Post #3


Super Maniac
*****

Group: Administrators
Posts: 1,211
Joined: 6-July 04
From: Melbourne, Australia
Member No.: 424



QUOTE (Reynard @ Feb 10 2010, 07:01 PM) *
So why does my example not compile with BoostC but it does with another PIC compiler.


Probably because of a bug in BoostC. I don't know yet. Will investigate.

Regards,
Pavel
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 3rd September 2010 - 02:55 PM