Good day!
I'm having problems with my lab activity(which I can't find the solution), it's already graded but I have to finish it and to make it function.
Is there something wrong with the way I reallocated space? Please help me find the solution for this.
I have problems during compile time, it says: invalid type argument of unary '*'PS.Code:int getInputs(int **ptr) { int x, w; int i=0; int y=0; int *pTemp; *ptr = malloc(sizeof(int)*10); do { print("enter number here:"); scanf("%d", &x); if (i<10) { if(x>0) { *(*ptr + i) = x; i++; y++; } else if(x==0) { *(*ptr + i) = x; i++; } } else { w=i++; if(x>0) { pTemp = realloc(ptr, sizeof (int) * 10); *(*pTemp + w ) = x; // invalid type argument of unary '*' y++; w++; } else if(x==0) { *(*pTemp + w ) = x; // invalid type argument of unary '*' w++; } } }while(x>=0); return y; }