What have I one wrong in this C++ code?

+2 Tom Weekes · February 27, 2015
Sorry, I just realised that the very last bit of the code is missing for some reason. Here it is again.
I am using CodeBlocks 13.12. I wanted to try Bucky's 35th C++ video tutorial but I got a completely different result.
When I run the code it's listing 4285920 endlessly.
I looked through the code many times but couldn't spot the error. Can anyone help, please?

using namespace std;

void printArray(int theArray[], int sizeOfArray);

int main()
    int box[3] = {2,45,789};
    int pack[6] = {1,123,8,954,7,3};

    printArray(box, 3);

    return 0;


void printArray(int theArray[], int sizeOfArray){

    for(int x=0; x=sizeOfArray; x++){

Post a Reply


Oldest  Newest  Rating
0 K D · February 27, 2015
Look at your first version of this post.
0 Tom Weekes · February 28, 2015
Thanks. It's done.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator