New programming and problems (c Programming in Linux)
Source: Internet
Author: User
New programming, problems (c Programming in Linux) -- Linux general technology-Linux programming and kernel information, the following is a detailed description. To achieve this function: Count the maximum number and number of occurrences of each array. For the error message, see the end. What is the problem with this program? Thank you.
# Include
Int n;
Int max (a, n)
{
Int a [n];
Int c;
Int imax;
Imax = a [0];
For (c = 0; c {If (imax = a [c];
}
Return (imax );
}
Int com (x, n)
{
Int x [n], y [n], z [n];
Int * p;
Int I, j, k, d, m, max1, max2;
For (I = 0; I {
K = 0;
P = x;
For (j = I + 1; j {
If (* p = x [j])
K = k + 1 ;}
Y
= * P; Z= K; P ++; } Max1 = max (z, n ); For (I = 0; I {If (z= Max1) Max2 = y; } Printf ("% d, % d \ n", max2, max1 ); }
Int main () { Int a1 [] = {8, 5, 5, 6, 5, 8, 11, 12, 0 }; Int a2 [] = {2, 11, 6, 9, 11, 19,5, 0 }; Int a3 [] = {, 0 }; Int a4 [] = {6, 14, 13, 16, 4, 8, 9, 0 }; Int a5 [] = {, 0 }; Int a6 [] = {4, 3, 6, 5, 4, 8, 9, 0 }; Int a7 [] = {5, 16, 2, 2, 11, 15, 16, 2, 0 }; Int * q; N = 0; For (q = a1; * q! = 0; q ++) N = n + 1; Com (a1, n ); Com (a2, n ); Com (a3, n ); Com (a4, n ); Com (a5, n ); Com (a6, n ); Com (a7, n ); }
Error message: T18.c: In function 'Max ': T18.c: 5: warning: declaration of 'A' shadows a parameter T18.c: In function 'com ': T18.c: 20: warning: declaration of 'X' shadows a parameter
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.