Home > Back-end > C object array element can be replicated
C object array element can be replicated
Time:10-20
My small white, reference Tan Haoqiang writing for a long, bosses to see this line not line
void A: : sor (A s [], int n) { Int I, j, k; A cc [1]={ A (0, "0", 0) }; For (I=0; i { K=I; For (j=I + 1; J & lt; n; J++) If (s [k]. Sc & lt; S [j]. Journal of sc) K=j; Cc [k] [0]=s; S [k] [I]=s; S=cc [0] [I]; } }
Through an intermediate array variable cc [0] to define an array element sorted ok Then how to call this member function in the main function
Stu [10]. Sor (stu, 10); Cout & lt; <"The sorted array:" & lt; For (I=0; i <10; I++) Stu [I] show ();
This call can be output correctly, but there will be a warning "from" stu "reads the data is invalid: readable size for" 360 "bytes, but may read" 396 "byte" And I feel so call the sor (A s [], int) function is wrong, don't know what's the right way to call