No matter what I try to do here, I always come out with a result of 4 when I do a sizeof(argv[1]). No matter how large or small the input is on the command line, the sizeof always returns 4.
My question now is, how can I get the size of the array that holds the char data from the input of the command line?
Some code I tried:
And the output? 4 on both lines. It's starting to confuse me.Code:int main(int argc, char **argv) { int x = sizeof(argv[1]); std::cout << x << "\n"; x = sizeof(argv); std::cout << x << "\n"; return(0); }