Given that scanf has (const char *) in the documentation from Microsoft and the answer to this question , what happens when I do the same to advance (char **) to (const char **)?
Basically, why is this compiling?
#include <stdio.h> int main(int argc, char **argv) { char szArray[50]; int i = 0; strcpy(szArray,"10"); /* the following code is upcasting the (char *) to (const char *) */ sscanf(szArray,"%d",&i); return 0; }
And why doesn't this compile?
#include <stdio.h> void processargs(const char **p) { } int main(int argc, char **argv) { processargs(argv); return 0; }
Both seem to be doing the same with the pointer!
source share