Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

291
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!