Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Sorting a mattrix

NeedHelp57NeedHelp57 Member Posts: 10
I am creating a mattrix using an array of [4][5]. I am having problems sorting the mattrix in descending order.
Can someone tell me what I am doing wrong?

int resort (int a[4][5])
{//Error messages is "LOCAL FUNCTION DEFINITIONS ARE ILLEGAL"
int n=20;
int i;
int j;
int temp;
for (i=0; i<n-1; ++i)
{
for (j=n-1; i<j; --j)
{
temp = a[j][j];
a[j][j] = a[j-1][i-1];
a[j-1][j-1] = temp;
}
}
}
return a[0][0];
}

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    Too many close braces -- remove the brace just before the return statement.
  • Shawn CarterShawn Carter Member Posts: 0

    ________ [ http://forcoder.org ] free ebooks and video tutorials about // Visual Basic .NET Go PL/SQL Scratch C# Java Delphi Objective-C Assembly Python C++ JavaScript C Visual Basic Swift MATLAB Perl Ruby PHP R Scala ML Alice Lisp Transact-SQL Apex Rust Julia Ada Crystal Erlang Kotlin FoxPro Prolog D Lua Fortran F# Awk LabVIEW Dart Clojure SAS COBOL Hack Bash ABAP Scheme Logo VBScript // ____________

Sign In or Register to comment.