Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

Array pointer and Array are the same?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kenny - 14 Mar 2005 10:55 GMT
Will is affect the result if I pass Array Pointer as a parameter to a
function compare to Array as a parameter?
For example,
BYTE buffer[1024]
a.) function(&buffer)
b.) function(buffer)
Is it any differences between (a) and (b)?
Thanks in advance.

Kenny
Michael Nemtsev - 14 Mar 2005 13:07 GMT
Hello Kenny,

> Will is affect the result if I pass Array Pointer as a parameter to a
> function compare to Array as a parameter?
[quoted text clipped - 3 lines]
> b.) function(buffer)
> Is it any differences between (a) and (b)?

buffer == &buffer == &buffer[0]
ismailp - 15 Mar 2005 00:41 GMT
a. function prototype (it seems) does not allow. &buffer is
BYTE(*)[1024].
This means, pointer to a BYTE array with size of 1024 elements. But
function, as far as I can understand, expects either BYTE[], or a
BYTE*.

the function prototype that would accept your example should be

int f(BYTE (*pArr)[1024[);

b. function prototype is either BYTE[] or BYTE* (I guess, may be a void
pointer, or something else that accepts any of BYTE[] or BYTE*). In
that case, "b" should compile, but "a" should give an error.

if your intent is to write something that can accept both arrays and
arrays of arrays, try to use templates.

Ismail Pazarbasi
Kenny - 15 Mar 2005 02:42 GMT
thanks..
got it... :)

> a. function prototype (it seems) does not allow. &buffer is
> BYTE(*)[1024].
[quoted text clipped - 14 lines]
>
> Ismail Pazarbasi

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.