char ** buildArray(int* target, int targetSize, int n, int* returnSize){ char** arr = (char**)calloc(200,sizeof(char*)); int i, j=0, pst=0; for(i=1; i<=n && j<targetSize; i++){ arr[pst++]="Push"; if(target[j] != i) arr[pst++]="Pop" ; else j++; } *returnSize=pst; return arr; }