Click here to Skip to main content
15,885,881 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I just played yesterdays with c++ in codeblocks. I created an array with 2 rows and 3 columns and I wanted to print the values.

But when I run the build and debug button in Code::Blocks I take this errror from the compiler (I use gcc)

||=== Build: Debug in loops (compiler: GNU GCC Compiler) ===|
C:\Users\Posd\Documents\C++\loops\loops.cpp|13|error: 'colums' was not declared in this scope|
||=== Build failed: 1 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|


My code is the following and I caouldn't understand what I doing wrong.

C++
#include <iostream>

using namespace std;

main()
{
        int array[2][3] = {{5,8,9,},{2,5,6}};

        for(int rows = 0;rows<2;rows++)
        {
            for(int columns=0;columns<3;columns++)
            {
                cout << array[rows][columns] << " ";
            }

            cout << endl;
        }
}
Posted
Updated 8-Dec-14 3:43am
v2

1 solution

I solve it! :P

The name columns in the increase statement in loop was colums. I fix it.
 
Share this answer
 
Comments
Emre Ataseven 8-Dec-14 10:54am    
Accept your answer to close thread.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900