Tuesday 15 April 2014

c - argv pointer to an array of pointers -


How am I confused that the following latter coincides with how this code:

< P> Since argv is an indicator for an array of pointers , we can manipulate the pointer instead of the index of the array. This next version is based on increasing argv, which is an indicator for four, whereas argc is counted:
  #include  1) "": ""); Printf ("\ n"); Return 0; }   

is not four * argv [] just an array of indicators? For an array of indicators, an indicator should not be written as char * (* argv []) or something similar?

As a side note, is it normal? I get announcements which mix instead of arrays and signals instead of confusing them?

The word "indicator for array" or "point to an array" is often often in c glossary They are loosely treated, they can have at least two different things.

In the most harsh and scholarly sense of the word, the "indicator for array" is declared with the "indicator for array" type Should be done, as

  int a [10]; Int (* P) ​​[10] = & amp; a;   

In the above example, p is declared as an array of 10 int s and it actually points to this point An array starts up to

However, this word often has a less formal meaning. In this example

  int a [10]; Int * p = & amp; A;   

P is declared as an indicator only as int . This array is started to indicate the first element of a . You can often hear and see people saying that in this case p also indicates the "array" of int s even if this situation is the last one Has different meanings. In this case "points of an array" means "indicator provides access to elements of an array through arithmetic", such as p [5] or * (p + 3 ) .

This is what is meant by the phrase "... argv indicator for an array of indicators ..." you quoted. In the parameter list of main , the declaration of argv is equivalent to char ** argv , which means that argv is actually There is an indicator for a char * pointer. But since it indicates the first element of some array of physically four * points (maintained by the calling code), it is right to say semi-informally that Argv indicates an array of pointers.

This is exactly what the text quoted by you means.

No comments:

Post a Comment