Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 691
Mahesh Avatar asked Feb 10 '23 10:02

Mahesh


1 Answers

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.

like image 63
fuz Avatar answered Feb 21 '23 19:02

fuz