From: "Johan Venter" Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c++,comp.os.msdos.djgpp,comp.os.msdos.programmer References: <7n6153$eqc$1 AT autumn DOT news DOT rcn DOT net> Subject: Re: Help with Casts... Lines: 53 X-Newsreader: Microsoft Outlook Express 4.72.3110.1 X-Mimeole: Produced By Microsoft MimeOLE V4.72.3110.3 Message-ID: Date: Thu, 22 Jul 1999 14:04:32 +1000 NNTP-Posting-Host: 203.40.82.147 X-Trace: newsfeeds.bigpond.com 932642908 203.40.82.147 (Thu, 22 Jul 1999 21:28:28 EST) NNTP-Posting-Date: Thu, 22 Jul 1999 21:28:28 EST Organization: Telstra BigPond Internet Services (http://www.bigpond.com) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Tom wrote in message <7n6153$eqc$1 AT autumn DOT news DOT rcn DOT net>... >I'm am having trouble understanding casts. Let's say I want to call a >program and it takes three variables. Two of those variables are casts and >are supposed to return values from what I understand. How do I get those >two values. > >Example; > >int playcdtrack(tracknumber, *startingposition, *endingposition) > >How do I get the variables startingposition and endingposition of let's say >track #1? > >If anyone can help I would greatly appreciate. Thanks. These are not casts you are talking about, but pointers. Here's an example: int a = 10; int *b = &a; //b = the address of a, so a = *b and vise versa Bad example, I know. In playcdtrack() when referencing the last two variables you should use an asterisk to reference what the pointer points to, rather than the address the pointer holds, so, quick example: void playcdtrack(int tracknumber, int *startingposition, int *endingposition) { *startingposition = find_starting_position_of_track(tracknumber); //just example code, use your own code here *endingposition = find_ending_position_of_track(tracknumber); } int main(void) { int start, end; playcdtrack(1, &start, &end); // & = THE ADDRESS OF return 0; } I hope I didn't make any mistakes in that code, i'm in a hurry. If I did then I'm going to be pretty embarressed. -- Johan Venter ICQ 3643877 Visit The TPU DJGPP Interest Group: http://surf.to/djgppig