Where are C/C++ main function's parameters?

remainn picture remainn · Nov 16, 2010 · Viewed 20.2k times · Source

In C/C++, the main function receives parameters which are of type char*.

int main(int argc, char* argv[]){
  return 0;
}

argv is an array of char*, and points to strings. Where are these string located? Are they on the heap, stack, or somewhere else?

Answer

Stu picture Stu · Nov 16, 2010

They are compiler magic, and implementation-dependent.