- Registriert
- 17.07.08
- Beiträge
- 41
Hi Leute,
wieso wird unter OS X bei int* q eine 0 Ausgegeben und unter Win und Linux die Speicheradresse? Wird in OS X nicht der Gnu C++ Compiler verwendet? oder ist das hier wieder so ein modifizierter/angepasster von Apple?
Ausgabe:
wieso wird unter OS X bei int* q eine 0 Ausgegeben und unter Win und Linux die Speicheradresse? Wird in OS X nicht der Gnu C++ Compiler verwendet? oder ist das hier wieder so ein modifizierter/angepasster von Apple?
Code:
[COLOR=#DF0001][COLOR=#7d4625]#include [/COLOR]<iostream>[/COLOR]
[COLOR=#ca00a6]usingnamespace[COLOR=#7c1aaf]std[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
[COLOR=#ca00a6]int[/COLOR] main ([COLOR=#ca00a6]int[/COLOR] argc, [COLOR=#ca00a6]const[/COLOR] [COLOR=#ca00a6]char[/COLOR] * argv[])
{
[COLOR=#ca00a6]int[/COLOR]* p = [COLOR=#4400e0]0[/COLOR];
[COLOR=#ca00a6]int[/COLOR]* q;
[COLOR=#7c1aaf]cout[/COLOR] << p << [COLOR=#df0001]" "[/COLOR] << q << [COLOR=#480086]endl[/COLOR];
[COLOR=#ca00a6]if[/COLOR] (q != [COLOR=#4400e0]0[/COLOR]) {
q = [COLOR=#ca00a6]new[/COLOR] [COLOR=#ca00a6]int[/COLOR];
*q = [COLOR=#4400e0]10[/COLOR];
}[COLOR=#ca00a6]else[/COLOR]{
q = [COLOR=#ca00a6]new[/COLOR] [COLOR=#ca00a6]int[/COLOR];
*q = [COLOR=#4400e0]20[/COLOR];
}
[COLOR=#7c1aaf]cout[/COLOR] << p << [COLOR=#df0001]" "[/COLOR] << q << [COLOR=#df0001]" "[/COLOR] << *q << [COLOR=#480086]endl[/COLOR];
[COLOR=#ca00a6]return[/COLOR] [COLOR=#4400e0]0[/COLOR];
}
Ausgabe:
Code:
[B]0 0
[/B][B]0 0x100100a30 20[/B]