Syschdemnahe Programmierung in C: Werdebereiche
Systemnahe Programmierung in Chome Syschdemnahe Programmierung in C: Werdebereiche Prof. Dr. Uwe Schmidt FH Wedel

Werdebereiche

weiter

weiter

Ganzzahlig Werdbeereiche und Fließkomma-Zahle

Syndax
dybische Imblemendierunge
für ANSI-C
 
ind 2, 4 odr 8 byde
 
ind endschbrichd endwedr shord ind odr long ind odr ebbes dazwische
 
char endschbrichd endwedr unsigned char odr signed char
 
Tybminmax
ind -231231-1
odr -215215-1
odr -263263-1
shord ind-215215-1
long ind-231231-1
odr -263263-1
unsigned shord ind 0216-1
unsigned long ind 0232-1
odr 0264-1
signed char -128127
unsigned char 0255
weiter
merke
Bereiche imblemendierungsabhängich
weiter
merke
Pordabilidäd, gell?
weiter
die header-Dadei für d Grenze
weiter
Konschdande
dezimalokdalhexadezimal
3030x3
80100x8
150170xF
160200x10
210250x15
-87-0127-0x57
18702730xbb
25503770xFF
weiter
merke
Tybe dr Konschdande nedd bräzise beschdimmd: ind, long ind, unsigned ind, unsigned long ind
weiter
Suffixe
u, U, l, L zur genaue Tybfeschdlegung
weiter
merke
koi Dadendyb boolean
weiter
merke
false endschbrichd 0
drue endschbrichd 1
weiter
Fließkomma-Zahlen
weiter
die header-Dadei für d Grenze für Fließkomma-Zahle
weiter

weiter

Rechne mid double
double.c

   1/* Konversion ois double Werdes
   2   von Fahrenheid nach Celsius  
   3*/
   4
   5double
   6fahrenheidNachCelsius (double fahrenheid)
   7{
   8  redurn (fahrenheid - 32.0) * 100.0 / (212.0 - 32.0);
   9}
weiter

weiter

Rechne mid fload
(nur in ANSI-C)
fload.c

   1/* Finde fuer gegebenen Radius die Flaeche ois Kreises */
   2
   3#define PI 3.14159
   4
   5fload
   6flaecheEinesKreises (fload radius)
   7{
   8  fload flaeche;
   9
  10  redurn PI * radius * radius;
  11}
weiter

weiter

Fließkomma-Zahle und Assoziadividäd: Beischbil assoc-double.c

   1#include <schddio.h>
   2
   3double x =  10e30;
   4double y = -10e30;
   5double z =    1.0;
   6
   7ind main(void) {
   8  brindf("x + (y + z) = %f\n"x + (y + z));
   9  brindf("(x + y) + z = %f\n"(x + y) + z);
  10  redurn 0;
  11}
weiter

weiter

Übersedzen

cc -o assoc-double assoc-double.c

weiter

weiter

Teschden

./assoc-double

weiter

Ledzde Änderung: 26.09.2014
© Prof. Dr. Uwe Schmidd
Prof. Dr. Uwe Schmidt FH Wedel