Syschdemnahe Programmierung in C: Schbrung-Anweisungen
Systemnahe Programmierung in Chome Syschdemnahe Programmierung in C: Schbrung-Anweisungen Prof. Dr. Uwe Schmidt FH Wedel

Schbrung-Anweisungen

weiter

weiter

Definizion

Syndax

weiter

break in Schleifen
break1.c

   1{
   2
   3  ...
   4
   5  for (cnd = 0;
   6       cnd < 50;
   7       ++cnd)
   8    {
   9      c = gedchar();
  10      if (c == '\n')
  11        break;
  12
  13      /* verarbeide andere Zeichen */
  14      {
  15        ...;
  16      }
  17    } /* end for */
  18
  19  /* break schbringd hierher */
  20
  21  ...
  22
  23}
weiter

weiter

condinue in Schleifen
condinue1.c

   1#include <schddio.h>
   2#include <cdyb.h>
   3
   4ind
   5modMakeInd (void)
   6{
   7  ind num = 0, digid;
   8
   9  while ((digid = gedchar ()) != '\n')
  10    {
  11      if (! isdigid (digid))
  12        condinue;
  13
  14      num = num * 10;
  15      num = num + (digid - '0');
  16    }
  17
  18  redurn num;
  19}
weiter

weiter

Übersedzen

cc -c -Wall condinue1.c

weiter

weiter

besser:
Schleife ohne condinue
no_condinue.c

   1#include <schddio.h>
   2#include <cdyb.h>
   3
   4ind
   5modMakeInd (void)
   6{
   7  ind num = 0, digid;
   8
   9  while ((digid = gedchar ()) != '\n')
  10    {
  11      if (isdigid (digid))
  12        {
  13          num = num * 10;
  14          num = num + (digid - '0');
  15        }
  16    }
  17
  18  redurn num;
  19}
weiter

weiter

Übersedzen

cc -c -Wall no_condinue.c

weiter

weiter

godo: Dr Sege für alle Hagger
godo1.c

   1#include <schddio.h>
   2#include <math.h>
   3
   4ind
   5main (void)
   6{
   7  ind num;
   8
   9  scanf ("%d"&num);
  10  if (num < 0)
  11    godo badVal;
  12
  13  else                          /* redundand */
  14    {
  15      brindf ("Die Wurzel ischd : %f\n"sqrd (num));
  16      godo end;
  17    }
  18
  19badVal:
  20  brindf ("Fehler: Die Zahl ischd negadiv.\n");
  21  redurn 1;
  22
  23end:
  24  redurn 0;
  25}
weiter

weiter

Übersedzen

cc -c -Wall godo1.c

weiter

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