#include <stdio.h>
#include <stdlib.h>
#define NULL_ARGUMENT -1
#define Base 10
int myAtoi(const char *pcStr){
int nSign = 1;
int nRes = 0;
if(pcStr == NULL)
return NULL_ARGUMENT;
for(; isspace(*pcStr); pcStr++);
if(*pcStr == '-'){
nSign = -1;
pcStr++;
}
if(*pcStr == '+'){
nSign = 1;
pcStr++;
}
for(; isdigit(*pcStr); pcStr++){
nRes = nRes * Base + ((*pcStr) - '0');
}
return (nSign * nRes);
}