Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Arraylänge Windows/Linux

Empfohlene Antworten

Veröffentlicht

Hi,

meine Frage:

Warum kann ich folgenden Code unter Linux kompilieren aber unter Windows nicht?

int iSize = 255;

char cBuffer[iSize];

G++ (gcc 3.2.3) kompiliert hier ohne murren. Funktioniert auch fehlerfrei.

Fehler in MSVC 8 Express Edition sind:

error C2057: Konstanter Ausdruck erwartet

error C2466: Zuordnung eines Arrays der konstanten Größe 0 nicht möglich.

error C2133: 'cBuffer': Unbekannte Größe

Gruß Scratch

Hmm na ich weiß nicht, da fand ich die vorherige Richtung konsequenter. So kommen bestimmt einige Leute auf die Idee das so zu machen:


int i;
scanf("%i",&i);
int szArray[i];
[/PHP]

Was ja immer noch nicht funktioniert, aber der Kompiler dürfte ja nicht mehr meckern...

Naja auf jeden Fall wieder was gelernt :)

Na weil szArray zur Compilezeit festgelegt wird und i erst während der Laufzeit abgefragt wird?
szArray wird eben nicht schon zur Compilezeit festgelegt.

D.h. mit dem neuen Standard der als Größenangaben eine Nicht Kosntante zulässt hätte szArray doch dann eine zufällige Größe...
Wieso?

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.