next up previous
Next: Call by Pointer Reference Up: Pointer Puzzles Previous: Call by Value II

Call by Value III

void func(int r)
{
    cout << r << endl;
    r=7;
}

main()
{
    int i=3;
    func(i);
    cout << i << endl;
}

i wird durch Zuweisung an r nicht modifiziert!
Ausgabe:
3
3


next up previous
Next: Call by Pointer Reference Up: Pointer Puzzles Previous: Call by Value II

© 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 3/19/1998