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.

2dim Arrays mit Werten füllen -> Endlosschleife..wtf?

Empfohlene Antworten

Veröffentlicht

Mahlzeit! Ich habe in meinem Programm neun Strukturen(structs), die jeweils ein 2dim Array enthalten. Beim start des Programms sollen diese in folgender Schleife mit Nullen gefüllt werden:


for (int n=0;n<11;n++)

 {

  for (int i=0;i<24;i++)

   {

     struct1.Array[n][i]=0;

     struct2.Array[n][i]=0;

     struct3.Array[n][i]=0;

     struct4.Array[n][i]=0;

     struct5.Array[n][i]=0;

     struct6.Array[n][i]=0;

     struct7.Array[n][i]=0;

     struct8.Array[n][i]=0;

     struct9.Array[n][i]=0;

//    cout << "wert " << n << " " << i << "\n";

   }

 }

Sobald der Wert "n" jedoch 10 erreicht, kommt das Programm in eine Endlosschleife. Die Ausgabe sieht dann wie folgt aus:

wert 9  23

wert 10 0

wert 10 1

wert 10 2

wert 10 0

wert 10 1

wert 10 2

wert 10 0

wert 10 1

wert 10 2

...endlos

Was mache ich falsch? Warum funktioniert es bis n=9 und dann nicht mehr?

Danke für die Hilfe,

Anday

struct Name {int Array[10][23]; char typ;};

*hand an Stirn klatsch* hmm... bin wohl nicht ganz ausgeschlafen..

vielen Dank.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.