Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7588635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:58:16+00:00 2026-05-30T19:58:16+00:00

I just write a simple program to print the address of variable. #include <stdio.h>

  • 0

I just write a simple program to print the address of variable.

#include <stdio.h>

void main(){
  int *a;
  int b;

  b=5;
  a=&b;

  printf("\n*a is the value of the integer:  %d\n",*a);
  printf("&a is the address of variable a: %p\n", &a);
  printf(" a is the address stored in a:   %p\n",a);
  printf("&b is the address of variable b: %p\n\n",&b);
}

The result is:

*a is the value of the integer:  5
&a is the address of variable a: 0x7fff935ad2b0
 a is the address stored in a:   0x7fff935ad2bc
&b is the address of variable b: 0x7fff935ad2bc

Why the addresses printed are not in the standard form?

Sorry for the silly question, but I just don’t understand.

EDIT

I have another program

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct small{
  int a;
};

int main(){
   struct small *sm;

   sm = malloc(sizeof(struct small));
   memset(sm,0,sizeof(struct small));

   sm->a = 5;

   printf("The address of sm is: %p\n", &sm);
   printf("The address stored in sm is: %p\n", sm);

   return 0;
}

The output is:

The address of sm is: 0x7fffd1363158
The address stored in sm is: 0x17a3010

So I expected the format 0x17a3010 is somewhat standard to me.

And again why in this case the format of %p is different?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:58:18+00:00Added an answer on May 30, 2026 at 7:58 pm

    That is called hexadecimal, i.e., base-16. It makes it easier to view groups of bits as bytes than binary or base-10 would. I’m not sure I understand your question. There is no “standard form”, but if there were one this would be it.

    Per your edit:

    The output is:

    The address of sm is: 0x7fffd1363158
    The address stored in sm is: 0x17a3010
    So I expected the format 0x17a3010 is somewhat standard to me.

    And again why in this case the format of %p is different?

    Those two are exactly the same. 0x17a3010 is no different than 0x00000000017a3010.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just tried to write a simple C program on OSX Lion #include <stdio.h>
I'm trying to write a simple program in VC++ which will just initialize the
I'm just starting out writing trying to write a simple program in C and
#include <unistd.h> #include <stdio.h> #include <string.h> #include <sys/sendfile.h> #include <sys/stat.h> #include <fcntl.h> int main(){
how can I write just a simple disassembler for linux from scratches? Are there
I just want a simple tool that will help me quickly write scripts/packages that
I was wondering what the easiest way to write a simple form program or
I'm trying to learn Haskell, so I decided to write a simple program to
EDIT: void print(const int *v, const int size) { FILE *fpIn; fpIn = fopen(char-array.txt,
I trying to use OpenCL using HASKELL. I write a simple program converting a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.