17.12.2012 Aufrufe

4. Prozedurales Programmieren

4. Prozedurales Programmieren

4. Prozedurales Programmieren

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

2. Verbundkomponenten/Objektlokale Variablen:<br />

class IntList {<br />

int fst;<br />

IntList rst;<br />

}<br />

IntList empty() {<br />

return new IntList();<br />

}<br />

IntList append( int i, IntList xl ) {<br />

IntList il = new IntList();<br />

il.fst = i;<br />

il.rst = xl;<br />

return il;<br />

}<br />

public class SpeicherIllustration2 {<br />

public static void main( String[] ins ) {<br />

IntList il = append(3,empty());<br />

il = append( 134, il );<br />

il = append( 9, il );<br />

int i = Integer.parseInt( ins[0] );<br />

while( i > 0 ) {<br />

il = append( i, il );<br />

i--;<br />

}<br />

} }<br />

Speicherbedarf hängt von der Eingabe ab. Lebensdauer<br />

der Verbunde erstreckt sich von der Erzeugung<br />

bis zum Ende des Programmablaufs.<br />

0<strong>4.</strong>12.08 © A. Poetzsch-Heffter, TU Kaiserslautern<br />

114

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!