Re: C: Dividieren

Bernhard Walle <[email protected]>
Newsgroups gmane.linux.suse.programming
Message-ID <[email protected]>
* volker wirth <[email protected]> [2004-10-01 00:14]:
> das hört sich vermutlich etwas seltsam an, aber:
> ich benutze Dev-C++4 mit cygnus;
> Code:
> 
> float z = (1 / 2);
> printf("%f", z);
> 
> und er sagt mir: 0.000000

es wurden dir ja schon einige Antworten gegeben. Üblich ist aber
eigentlich nicht float sondern double (bei "normalen" Programmen):

   double z = 1.0 / 2.0;
   printf("z = %lf\n", z);


Gruß,
Bernhard

-- 
Es kann passieren, was will: Es gibt immer einen, der es kommen sah.
	-- Fernandel
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBXSkHiGU2lt2vZFQRAtntAJ9dqsidJXXALmoHXXuzhtchCC1vHgCgpEPc
AnIb/7XT0Z2YLl7F6bm65gM=
=EWN6
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.