In my program, I'm using the atoi() function to extract an int from argv. When I use:
#include <stdlib.h>
I get the following error:
cachesim.c:20: warning: passing argument 1 of ‘atoi’ from incompatible pointer type
However, if I do not include the stdlib.h I receive no error at all and my code functions properly. Why is this?
#include <stdlib.h>
#include <stdio.h>
int main(int argc, int **argv) {
    if (argc == 0){
        int blk = 32;
        int i;
        for (i = 1; i < argc; i++) {
            if (strcmp(argv[i], "-b") == 0) {
                if (i + 1 <= argc - 1)
                    blk = atoi(argv[i+1]);
            }
        }
    }
}
 
     
     
     
    