From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: function basics Date: Mon, 12 Oct 1998 06:29:50 -0400 Organization: Nocturnal Aviation Lines: 52 Message-ID: <3621DA1E.892CC4F2@earthlink.net> References: <01BDF5D9 DOT F64C3620 DOT ezfbtri AT ezf DOT ericsson DOT se> NNTP-Posting-Host: 1cust185.tnt12.nyc3.da.uu.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Posted-Path-Was: not-for-mail X-ELN-Date: Mon Oct 12 03:28:14 1998 X-Mailer: Mozilla 4.06 [en] (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com TRINITE wrote: > > try > > #include This is a very bad idea. The non-standard header is no substitute for the standard header > 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); The two &s in the printf need to be removed. > return 0; > } > > regards. > > >does anyone know why the code below displays always the same: 317072 > >317068. And to get it read and print data properly? > > #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); > > return 0; > > } -- Martin Ambuhl (mambuhl AT earthlink DOT net) Note: mambuhl AT tiac DOT net will soon be inactive