int main(int argc,char* argv[]){ int *ptr=new int; if(ptr==NULL) exit(1); char *j; for(int i=1; i<=4; i++) { j=argv[i]; int k=atoi(j); if (k!=0){ *ptr=k; delete ptr; } } }
Will this program execute successfully ?
program works when there is only 1 argument with program.
program works when there are 3 arguments with program.
program works when there are 4 arguments with program.
program never executes successfully.