KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q48732: Format Specifier %p Not Found in Documentation

Article: Q48732
Product(s): See article
Version(s): 2.00
Operating System(s): MS-DOS
Keyword(s): ENDUSER | docerr | mspl13_c
Last Modified: 10-OCT-1989

The format specifier %p was left out of both the QuickC Version 2.00
written documentation and the on-line help facility included with the
package. %p is used to display the contents of pointer variables. This
is useful for debugging programs that use pointers. The pointer should
be near or far, depending on the memory model. However, the pointer
size can be overridden with the "N" or "F" attribute, depicting near
or far, respectively. The following small model program declares two
pointers (near and far) and prints out their contents with printf:

#include <stdio.h>
void main(void)
{
  int     i    =1;
  int     *ptr =&i;
  int far *fptr=(int far *)&i;

  printf("the near pointer: %p    the far pointer: %Fp",ptr,fptr);
}

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.