Home > Back-end >  C language of a topic in asking who teach, can you help me point out my mistake, thank you
C language of a topic in asking who teach, can you help me point out my mistake, thank you

Time:06-05

: 1. The function program defines a two dimensional array of N * N, and the main function of automatic assignment, please write a function void fun (int a [] [N], int N), make a left lower triangular array element value multiplied by any integer N,
For example, if the value of n is 2, the values in the array to a
1 9 7 | | | 2 September 7 |
A=2 | 3 | 8 returns after the main program the values in the array should be 8 | | 4 6 a
12 | | 4 5 6 | | 8 to 10
Code: # include & lt; stdio.h>
#include
Int m;
Void fun (int n, int a [m] [m])
{
Int k, j;
for(k=0; K{
for(j=0; j{
If (k>=j)
{
A [k] [j] *=n;
}
}
}
};
Int main ()
{
Int n, I, l; Int a, [m] [m].
Printf (" the row and line of the array is ");
The scanf (" % d ", & amp; m);
Printf (" number want to multiply is ");
The scanf (" % d ", & amp; N);
for(i=0; i{
For (l=0; L{
The scanf (" % d ", & amp; A [I] [l]);
}
}
Fun (n, a);
for(i=0; i{
For (l=0; L{
Printf (" % d ", a [I] [l]);
}
}
system("pause");
}

CodePudding user response:

1 Windows. What h is a ghost, there should be no

2 the int a [m] [m] definition on the scanf (" % d ", & amp; M) after the line
Otherwise I don't know the size of a, I just wasn't allocate space

Three output without blank space to separate each column, block that did not use the enter each line separately
% d behind add a space, the inner loop with a carriage return output

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related