| delorie.com/archives/browse.cgi | search |
| From: | Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: A newbie question: out to print out value of doubles? |
| Date: | Mon, 09 Dec 1996 10:20:19 +0100 |
| Organization: | Lehrstuhl fuer Stroemungsmechanik |
| Lines: | 49 |
| Message-ID: | <32ABD9D3.41C6@LSTM.Ruhr-UNI-Bochum.De> |
| References: | <32a98413 DOT 1518950 AT news DOT diac DOT com> <32A9892D DOT 3AC3 AT cornell DOT edu> |
| NNTP-Posting-Host: | bvb.lstm.ruhr-uni-bochum.de |
| Mime-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
A. Sinan Unur wrote:
>
> Richard Adams wrote:
> >
> > void main(void)
>
> please don't do this. main is supposed to return an int no matter what
> some books tell you.
>
> > {
> > double a=3.125978724;
> >
> >
> > printf("The variable a is:\n\t");
> > fprintf ("%f\n", &a);
> >
> > 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!!
>
> well, fprintf is not fscanf. when you are using the printf functions you
> only need to specify the name of the variable.
And maybe you should have a look at the info
about fprintf(). The incompatible pointer type
stems from feeding a pointer to a string into it,
when a pointer to a FILE was expected. The warning
about wrong arguments in the ... part of ?(printf|scanf)
functions is only issued if you turn on some warnings.
Best use -Wall to get them all.
--
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* Voice/Fax Box: +49 2561 91371 2056 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |