Using the p, n, and % conversion specifiers : printf conversion « printf scanf « C Tutorial

Home
C Tutorial
1.Language
2.Data Type
3.String
4.printf scanf
5.Operator
6.Statement
7.Array
8.Function
9.Structure
10.Pointer
11.Memory
12.Preprocessor
13.File
14.Data Structure
15.Search Sort
16.Wide Character String
17.assert.h
18.ctype.h
19.math.h
20.setjmp.h
21.signal.h
22.stdio.h
23.stdlib.h
24.string.h
25.time.h
26.wctype.h
C / ANSI-C
C++
C++ Tutorial
Visual C++ .NET
C Tutorial » printf scanf » printf conversion 
4.14.1.Using the p, n, and % conversion specifiers
#include <stdio.h>

int main()

   int *ptr;
   int x = 12345;
   int y;        
   
   ptr = &x;     
   printf"The value of ptr is %p\n", ptr );
   printf"The address of x is %p\n\n", &x );

   printf"Total characters printed on this line:%n", &y );
   printf" %d\n\n", y );

   y = printf"This line has 28 characters\n" );
   printf"%d characters were printed\n\n", y );
   
   printf"Printing a %% in a format control string\n" );

   return 0;

}
The value of ptr is 9a378
The address of x is 9a378

Total characters printed on this line: 38

This line has 28 characters
28 characters were printed

Printing a % in a format control string
4.14.printf conversion
4.14.1.Using the p, n, and % conversion specifiers
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.