
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
What is the use of `%p` in printf in C?
In C we have seen different format specifiers. Here we will see another format specifier called %p. This is used to print the pointer type data. Let us see the example to get a better idea.
Example
#include<stdio.h> main() { int x = 50; int *ptr = &x; printf("The address is: %p, the value is %d", ptr, *ptr); }
Output
The address is: 000000000022FE44, the value is 50
- Related Articles
- What is the use of %n in printf()?
- What is the correct way to use printf to print a size_t in C/C++?
- What is the difference between printf() and cout in C++?
- How to use printf () in Android sqlite?
- Execution of printf with ++ operators in C
- How to use formatting with printf() correctly in Java?
- Return values of printf() and scanf() in C
- What is the use of "is" keyword in C#?
- What is the use of cin.ignore() in C++?
- printf(), sprintf() and fprintf() in C
- What is the use of "placement new" in C++?
- What is the use of sizeof Operator in C#?
- What is the use of ‘new’ keyword in C#?
- What is the use of ‘Using’ statement in C#?
- What is the use of static constructors in C#?

Advertisements