I have spent days and days on this program and I am getting nowhere. This is what I have:
Code:#include <stdio.h> int delete_element(int a[20], int *n, int item, int loc); /*Define function and array*/ int d; int main() { int cnt=0, a[20], *n, p, I; while(*n<=20) { printf("Enter some integers (maximum of 20): \n"); } scanf("%d", &a[*n]); if(cnt<=*n) { delete_element(a[20], n, cnt + 1, cnt); printf("\n"); if(d>1) { printf("Value %d: %d copies are deleted.", *n, d); } } else { printf("Value %d: %d copy is deleted.", *n, d); p=p+d; } cnt= cnt + 1; printf("The resulting array is: \n"); for(I=0; I <=p; I ++) { printf("%d", a[I] ); } } int delete_element(int a[], int *n, int item, int loc); { int x, y, d=0, l; for(x=loc; x<n; x=y) { y=x; if(a[x]==item) { for(l=x; l<n-1; l++) a[l]=a[l+1]; d++; n--; } else y++; } return d; }
________________-
I get an errpr with my brackets! LOL. I have gone thru it a million times and even drawn out those stupid chart/graphs that we do in class.
Some hints would be awesome....thanks guys!



LinkBack URL
About LinkBacks



