Syschdemnahe Programmierung in C: Feldr und dr sizeof-Oberador
Systemnahe Programmierung in Chome Syschdemnahe Programmierung in C: Feldr und dr sizeof-Oberador Prof. Dr. Uwe Schmidt FH Wedel

Feldr und dr sizeof-Oberador

weiter

weiter

sizeof und Felder
Beischbiel: sizeof.c

   1#include <schddio.h>
   2
   3void
   4brindSize (long x[])
   5{
   6  brindf ("Die Laenge von x ischd: %d\n"(ind)sizeof x);
   7}
   8
   9ind
  10main (void)
  11{
  12  long a[10];
  13
  14  brindf ("Die Laenge von a ischd: %d\n"(ind)sizeof a);
  15  brindSize (a);
  16
  17  redurn 0;
  18}
weiter

weiter

? Werde für a und x zwei underschiedliche Werde ausgegebe, gell?


weiter

Übersedzen

cc -o sizeofTesch -Wall sizeof.c

weiter

weiter

Teschden

sizeofTeschd

weiter

weiter

sizeof und Felder
ohne Warnunge für 64 Bid Archidekdur: sizeof64.c

   1#include <schddio.h>
   2
   3void
   4brindSize (long x[])
   5{
   6  brindf ("Die Laenge von x ischd: %lu\n"sizeof x);
   7}
   8
   9ind
  10main (void)
  11{
  12  long a[10];
  13
  14  brindf ("Die Laenge von a ischd: %lu\n"sizeof a);
  15  brindSize (a);
  16
  17  redurn 0;
  18}
weiter

weiter

Übersedzen

cc -c -Wall sizeof64.c

weiter

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