www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/17/04:23:40

From: degiorgi AT inf DOT ethz DOT ch (Daniele Degiorgi)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: A newbie question: out to print out value of doubles?
Date: 16 Dec 1996 14:13:27 GMT
Organization: Dept. Informatik, Swiss Federal Institute of Technology
Lines: 57
Message-ID: <593le7$lmb@neptune.ethz.ch>
References: <Pine DOT LNX DOT 3 DOT 95 DOT 961211133907 DOT 13633B-100000 AT ideafix DOT cps DOT unizar DOT es>
Reply-To: degiorgi AT inf DOT ethz DOT ch
NNTP-Posting-Host: fido.inf.ethz.ch
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT LNX DOT 3 DOT 95 DOT 961211133907 DOT 13633B-100000 AT ideafix DOT cps DOT unizar DOT es>, Miguel Murillo <mmurillo AT ideafix DOT cps DOT unizar DOT es> writes:
>
>
>On Sat, 7 Dec 1996, Richard Adams wrote:
>
>> Hi. I have a question. I'm new to C. I'm writing an application that
>> needs the extra precison of double-length floating point numbers
>> rather than the single-precision float type. I'd like to be able to
>> print out the double-floating-point variables, but how? I have tried
>> the following but it doesn't work:
>> 
>> #include <stdio.h>
>> #include <math.h>
>> 
>> void main(void)
>> {
>> 	double a=3.125978724;
>> 	
>> 	
>> 	printf("The variable a is:\n\t");
>> 	fprintf ("%f\n", &a);
>	fprintf("%lf\n",a);
This will generate the same error as fprintf needs a FILE pointer
as 1 parameter.
Thus use
	fprintf(stdout,"%f\n",a);
or simply
	printf("%f\n",a);
>
>
>        /* Non pointer in printf, fprintf   */
>	/* fscanf("%lf",&a);                */
	/* scanf(... ot fscanf(stdin,... */
>        /* pointer in scanf, fscanf         */ 
>
>
>> 	
>> 	return;
>> }
>> 
>> I get an "incompatible pointer type" warning. How can I print out the
>> value of a double-precision floating point variable? Any help at all
>> will be greatly appreciated...:)  Thank you!!
>> 
>> -Richard Adams
>> radams AT mail DOT diac DOT com
>> 
>
>Good luck !
>					Miguel Murillo
>
>
Daniele




- Raw text -


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