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

前端 未结 10 1852
清酒与你
清酒与你 2020-11-29 02:31

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

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

10条回答
  •  悲哀的现实
    2020-11-29 02:37

    These parameters are no different than any other function's parameters. If the architecture's calling sequence requires parameters to go through stack they are on stack. If, like on, x86-64 some parameters go in registers these also go in registers.

提交回复
热议问题