delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/12/06:46:32.1

From: Martin Ambuhl <mambuhl AT earthlink DOT net>
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
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 <conio.h>

This is a very bad idea.  The non-standard header <conio.h> is no
substitute for the standard header <stdio.h>

> 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 <conio.h>
> > 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019