I need some advice into how to write the code.

I'm new to C...

I'll show you guys my code. There is something very wrong in this code, But I need help to see how to do it right.

Please, guys, don't post the solution... The code for void matrix works? Can you guys direct me into some content to learn or everything? It is my first time coding for real, so, any advices are wonderful.

Code: Put on pastebin for better checking. http://pastebin.com/SDS2MBn0

1 Answer 1


Your approach is good in that you want guidance, not someone to fix it for you! I wish more people looked at it this way. But, since you're so new to this, there's only one way to get you going without wasting a ton of time. Your big problem is your call to Mario.


Now look at the template for the function call:

void matrix (int column; int row; int space);

A function call needs to look like the template, so it should have the function name followed by parentheses. Inside the parentheses should be the exact number and type of parameters expected. Finally, it needs a semicolon to close the line. In your case, it should probably be:

matrix(col, row, sp);

I'll forego discussion of the remaining code and let you sort it out! You'll learn more that way.

My next advice is for you to read each problem set thoroughly. pset1 has recommended reading at the top that will greatly help you out. Next, each problem set document makes a great roadmap for the particular pset. Read them thoroughly, starting with GetInt() in pset1.

That should get you on the road in the right direction for the class.

  • exc1.c:7:18: error: use of undeclared identifier 'col' scanf( "%i", &col); ^ exc1.c:9:12: error: use of undeclared identifier 'col' matrix(col, row, sp); pastebin.com/L9Aa70An Commented Apr 12, 2015 at 13:34
  • Working in a new scope pastebin.com/ErbRv8RA Is that the right tought of scope? Commented Apr 12, 2015 at 13:37
  • Now you're on track. But check that while condition, it'll never execute as-is.
    – Cliff B
    Commented Apr 12, 2015 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .