INFO: A Case Where BUFF[] and *BUFF Are DifferentLast reviewed: October 7, 1997Article ID: Q38024 |
The information in this article applies to:
When the variable buff has been declared in an assembly-language program, such as the following
.data public buff _buff db 200 dup (0xab) .data endsthere is a difference between the two following C declarations:
extern unsigned char buff[]; extern unsigned *buff;The difference is that the first declaration says there is a block of memory that is named buff; the second says there is something called buff that is a pointer. This difference can be seen by referencing buff as follows:
buff[x]If buff is declared as an array, the referencing is correct. However, if buff is declared as a pointer, the referencing is incorrect. The data pointed to by buff (ab in this example) is translated into a memory address, then x bytes are added to it generating an incorrect reference. For additional information, please see the following article(s) in the Microsoft Knowledge Base:
ARTICLE-ID: Q44463 TITLE : Difference Between Arrays and Pointers in C Keywords : CLngIss kbfasttip Version : MS- DOS:5.1,6.0,6.00a,6.00ax,7.0;WIN3X:1.0,1.5,1.51,1.52;WINNT:1.0,2.0,2.1,4.0, 5.0; Platform : MS-DOS NT WINDOWS Issue type : kbinfo |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |