returning more that one varialble

Discuss PocketC for CE (including Desktop Edition)

Postby Red_as_blood on Fri Jan 31, 2003 3:51 pm

Hi every body i have a question:

I need made a funtion similar to gets() but with 2 editboxes. I this way i need to return 2 values (for example x1,y1)

is this possible because i don't know how to do...

i explane my self:


my_func(string title)
//components on the screen
//some calculations

return x1;
return y1;

int variable;

variable=my_func("Enter Coordinates")

//set the pixel on the screen with the 2 variables returned by the function


How do i get back from my function 2 variables

on the example code i just made you can return only one variable how can i do?

Sombody can explane or give me another solution??
Posts: 13
Joined: Sat Aug 10, 2002 2:06 pm

Postby wolfgang on Fri Jan 31, 2003 6:10 pm

You can do this by passing in the return variables as pointers in the functrion parameter list, or by returning a pointer to an array. Read the chapters about pointers in PocketC on my webpage (the ABC in the programming section) for more details.

There is a good, recent thread on this in the PalmOS PcoketC forum:


Composing music on the PocketPC! -
Composing music on the PocketPC! -
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 1 guest