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 7890861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:28:01+00:00 2026-06-03T06:28:01+00:00

{ int *p=12; printf(%p,p); printf(\n%d,p); } OUTPUT: 0000000C 12 Question: So is p assigned

  • 0
{
    int *p=12;
    printf("%p",p);
    printf("\n%d",p);
}

OUTPUT:

0000000C

12

Question: So is p assigned the address 0x0000000C?

{ 
    int *p=12;
    *p=22;
}    

But this one doesn’t run. So what’s actually happening?

  • 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-06-03T06:28:03+00:00Added an answer on June 3, 2026 at 6:28 am
    int *p=12;
    

    This declares a pointer and sets the address to which it points to 12.

    *p=22;
    

    This de-references the pointer and writes 22 to the int at that memory address 12. Since you did not allocate any memory and just set the pointer to point at a random address, it results in a runtime error.

    What is confusing you is that both pieces of code contain *p=.... However, the first assignment is to the pointer, and the second assignment is to the pointee. This is just one of those notational overloadings that you have to get used to when programming in C.

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

Sidebar

Related Questions

int m=32 printf(%x , ~m); Output of this statement is ffdf and without ~
class classe (){ public: int key; static void *funct(void *context){ printf(Output: %d, , key);
#include<stdio.h> int main() { printf(He %c llo,65); } Output: He A llo #include<stdio.h> int
Consider this code: void res(int a,int n) { printf(%d %d, ,a,n); } void main(void)
I have these two statements : printf(%u,a+1); and printf(%u,(int *)a+1); Actually I was working
int main() { int *d=0; printf(%d\n,*d); return 0; } this works fine. >cc legal.c
int main() { int i=3; (++i)++; printf(%d,i); } This programs works with g++ compiler
I executed the following code #include <stdio.h> int main() { printf(%f\n, 9/5); } Output
why is the output fffffffa rather than 0000000a for this code char c=0Xaa; int
#include<stdio.h> int main () { printf(%#04x,50); } Some one showed me above code and

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.