Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Does the plastic array have 0?
Does the plastic array have 0?
int func(int a[],int n)

{

int b[n];

int I;

int count = 0;

for(I = 0; I & ltn;; I++) // Copy non-zero integers to b[], and delete elements with a value of 0.

{

If (I)

b[count++]= a[I];

}

for(I = 0; I < count; I++) // Copy b[] to a[]

a[I]= b[I];

For(i = count; I & ltn;; I++) // Fill a[] The remaining elements are 0.

a[I]= 0;

Return (n count); //Returns the number of elements with a value of 0 in the original array A..

}