top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do you print an address in C?

0 votes
329 views
How do you print an address in C?
posted Jul 22, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Dont know the intent of the query, I believe you want to know how to print a pointer if that is the case then use %p to print a pointer.

p The argument shall be a pointer to void. The value of the pointer is converted to a sequence of printing characters, in an implementation-defined manner.

Example

main() 
{
    int a = 10;
    printf("The memory address of a is: %p\n", (void*) &a);
}
answer Jul 22, 2014 by Salil Agrawal
...