Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
int* ptr=0;
int *ptr=0;
bloedsinndie erste
falsch
// Eine Kurze Zeiger-Notations-Demonstration
#include <iostream.h>
void main()
{
// erstmal 2 Variablen füllen
int count1 = 5, count2 = 4;
// Fall 1: Der Asterisk hängt am Typ
int* pCount1 = &count1;
// Fall 2: Der Asterisk hängt am Namen. Hier sehen wir auch schon,
// warum eine solche Notation durchaus sinnvoll ist: Wir können
// direkt erkennen, welche Variable ein Zeiger ist und welche nicht,
// ich halte diese Notation für die leserlichste.
int count3 = *pCount1,
*pCount2 = pCount1;
// Fall 3: Der Asterisk fungiert als Trennzeichen.
// Ebenso würde 'int * pCount3' funktionieren
// Leerzeichen werden nicht berücksichtigt.
// Genau genommen ist dies die effizienteste Notation, aber
// leider auch die unleserlichste.
int*pCount3 = &count2;
cout << "count1: " << count1;
cout << "\ncount2: " << count2;
cout << "\ncount3: " << count3;
cout << "\npCount1 zeigt auf: " << *pCount1;
cout << "\npCount2 zeigt auf: " << *pCount2;
cout << "\npCount1 zeigt auf: " << *pCount3;
}
/* Programm-Output:
C:\>ptrtest
count1: 5
count2: 4
count3: 5
pCount1 zeigt auf: 5
pCount2 zeigt auf: 5
pCount1 zeigt auf: 4
*/
Falsch, VC++6 oder Visual Studio 6 benötigt das aktuelle SP sonst gibts auch FehlermeldungenOriginal von HAR2
Dem Compiler ist es sch**** egal.