arrays and pointers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Encrypted
    New Member
    • Mar 2008
    • 8

    arrays and pointers

    i want to clear a doubt...
    please check out the following codes..

    Code:
    int function (int p[])
    {
      //sm code
    }
    another style is :
    Code:
    int function (int *p)
    {
      // sm code
    }
    here i am passing an array to both the functions...and one receives it through p[] and another through *p....
    then what is the difference between both styles ??
    or just that the former uses subscript and the latter dereferences the pointer to access the values... ??
    please clear out my doubt...
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    There is not difference between those 2 syntaxes has far as functionality is concerned, in both cases the parameter p has type int *

    It is just 2 ways of writing the same thing.

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      You might want to read this article: http://www.thescripts.com/forum/thread772412.html.

      Comment

      Working...