array/refference passing

Discuss topics that apply across the products, such as the PocketC language, or development in general

Postby pktcperlcppcjava on Sat Nov 13, 2004 7:14 pm

I don't know why, but the standard c/c++ passing of arrays to a subroutine doesn't work. Nor does the java []. Anyone know how to do this or pass variable reffernece?

thanx

There are 10 types of people in the world, those who understand binary, and those who don't.
There are 10 types of people in the world, those who understand binary, and those who don't.
pktcperlcppcjava
 
Posts: 9
Joined: Sat Sep 25, 2004 9:59 pm
Location: USA

Postby wolfgang on Tue Nov 16, 2004 1:18 am

I assume you are talking about PocketC (not Orbforms, I don't have experience with that product). Passing an array is simple - you pass it as a pointer, which is a data type of its own in PocketC. Since PocketC has automatic type conversion, a pointer can point to any data type.

main
{
int my_array[100];
my_sub(my_array);
}

my_sub (pointer my_arr)
{
my_arr[10]=123;
}


Composing music on the PocketPC! - http://www.pdamusician.com
Composing music on the PocketPC! - http://www.pdamusician.com
wolfgang
 
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Postby pktcperlcppcjava on Tue Nov 16, 2004 8:41 pm

oh, thanx

There are 10 types of people in the world, those who understand binary, and those who don't.
There are 10 types of people in the world, those who understand binary, and those who don't.
pktcperlcppcjava
 
Posts: 9
Joined: Sat Sep 25, 2004 9:59 pm
Location: USA


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron