Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Collections Arrays Jagged Arrays

Name:GoogleSearch orJonathan Sum
Name:GoogleSearch orJonathan Sum
5,039 Points

SOS, i need help.

Why does it not work? Math.cs(9,16): error CS1525: Unexpected symbol `int' Compilation failed: 1 error(s), 0 warnings

namespace Treehouse.CodeChallenges
{
    public static class MathHelpers
    {

        public static int[][] BuildMultiplicationTable(int maxFactor)
        {
            int m1= maxFactor+1;
                int[][] BuildMultiplicationTable1 = new int[m1][];
                BuildMultiplicationTable[0] = new int[m1];
            for(int rowIndex = 0; rowIndex < BuildMultiplicationTable1.Length; rowIndex++)
            {

                for(int colIndex = 0; colIndex < BuildMultiplicationTable1[rowIndex].Length; colIndex++)
                {

                    maxFactor[rowIndex][colIndex] = rowIndex*colIndex;

                }
            }   
            return BuildMultiplicationTable1;


        }

    }
}

1 Answer

Steven Parker
Steven Parker
231,248 Points

:point_right: A few issues stand out:

  • on line 8 you forgot the semicolon at the end of the assignment statement
  • on line 10 you have the name of the function where you probably meant to use the name of the array
  • on line 17 you attempt to subscript the ordinary integer maxFactor (where you probably also want the array)
Name:GoogleSearch orJonathan Sum
Name:GoogleSearch orJonathan Sum
5,039 Points

In the previous videos , there is no c# function tutorial. I don't really what to do. Could you just post the corrected code for me?

Name:GoogleSearch orJonathan Sum
Name:GoogleSearch orJonathan Sum
5,039 Points

What happens in line 17? It said there is a error in line 9 ,whic is"Math.cs(9,16): error CS1525: Unexpected symbol `int' Compilation failed: 1 error(s), 0 warnings". I am sorry that i think even u don't really know what to do.

Steven Parker
Steven Parker
231,248 Points

The error that says "Unexpected symbol `int'" on line 9 is caused by the problem in my first hint:

:point_right: on line 8 you forgot the semicolon at the end of the assignment statement.

You really won't know if my hints are good until you try them.

Name:GoogleSearch orJonathan Sum
Name:GoogleSearch orJonathan Sum
5,039 Points

I added. It is still same. It said i need to remove the int in line 9. after i removed the the int, it said i need to remove the []. If i am going to remove the [] ,this is not longer be a array any more. Could u just try to run the correct code and make sure u r right?