Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

295
Visualizações
What is char*argv[ ] and how is it similar to char **argv

I am unable to understand how char *argv[] is similar to char **argv. Also please let me know when to use pointers?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

A function parameter declared as having array type is silently adjusted to having pointer type. Thus, if you declare a function with a parameter of type int x[], the parameter actually has type int *x. Similarly, char *argv[] in a function parameter is the same as char **argv as the array of pointers is adjusted to a pointer to pointer.

over 4 years ago · Santiago Trujillo Relatório

0

Basically char * argv[] is array of char pointers and char ** argv is pointer to char pointer.

As we pass it as function parameter char * argv[] is adjusted to pointer-type which points to initial element of that array, char ** argv and are both the same things.

6.7.5.3 Function declarators (including prototypes) ...

7 A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’, where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation. If the keyword static also appears within the [ and ] of the array type derivation, then for each call to the function, the value of the corresponding actual argument shall provide access to the first element of an array with at least as many elements as specified by the size expression.

As you see we use both definitions of main are equivalent -

int main(int argc, char ** argv)

And

int main(int argc, char *argv[])
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda