From: Alan Bork Newsgroups: comp.os.msdos.djgpp Subject: Re: function basics Date: Mon, 12 Oct 1998 09:14:37 -0500 Organization: Exec-PC BBS Internet - Milwaukee, WI Lines: 32 Message-ID: <6vt2s2$a1q@newsops.execpc.com> References: <3621C580 DOT C4C241F7 AT nceye DOT net> NNTP-Posting-Host: skaro-2-138.mdm.mke.execpc.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: daily-planet.newsops.execpc.com 908201666 10298 (None) 169.207.139.204 X-Complaints-To: abuse AT execpc DOT com X-Mailer: Mozilla 4.06 [en] (WinNT; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com see below... > Hya, > does anyone know why the code below displays always the same: 317072 > 317068. And to get it read and print data properly? > thanx > > #include > void prompt( int &hrs, int &mnts) > { > > printf("Plz enter begining time, separating hours & minutes"); > scanf ("%d %d", &hrs, &mnts); > > } > int main() > { > int hrs1, mnts1; > > prompt( hrs1, mnts1); > printf ("U entered %d and %d", &hrs1, &mnts1); ^^^^^^^^^^^^^ right here. I believe this will be interpreted as the address of hrs1 and mnts1 when passed to printf (printf being a "C" function). Try just ... printf ("U entered %d and %d", hrs1, mnts1); > return 0; > } Hope that helps Alan Bork