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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:21:46+00:00 2026-05-12T18:21:46+00:00

void main(){ int i,k; char* p; int j; printf(address of i is %d \naddress

  • 0
void main(){
    int i,k;
    char* p;
    int j;
    printf("address of i is %d \naddress of k is %d \naddress of p is %p\naddress of j is %d", &i,&k,&p,&j);

}

when I tried the above code, the address of j is 4 units below k. But the address of p is no where near. Since a pointer is an integer variable that could store 4 bytes of data, why isn’t it allocated on the stack like the other three variables?

  • 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-12T18:21:46+00:00Added an answer on May 12, 2026 at 6:21 pm

    You should post the output you’re getting. I suspect that you’re getting a bit confused because most of the addresses you’re printing are being displayed in decimal (using %d) while p is being displayed in hex (using %p).

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

Sidebar

Related Questions

consider the code #include<stdio.h> int main(void) { char* a; scanf(%s,a);//&a and &a[0] give same
#include <stdio.h> int main(void) { char s[] = {'a','b','c','\n','c','\0'}; char *p; p=&s[3]; printf(%d\t,++*p++); printf(%d,*p);
#include <stdio.h> void wrapperPrint(char* s) { printf(s); return; } int main() { wrapperPrint(Hello world\n);
I have the following code: #include <string.h> int main(void) { char *buffer = NULL,
Consider the following code in C: void main() { int a=0; for(printf(\nA); a; printf(\nB));
#include<stdio.h> void main(){ int x,y,z; x=y=z=1; z=++x||++y&&++z; printf(%d %d %d \n,x,y,z); getch(); } the
int main(void) { int x = 0; char* p = (char*) &x; int k
Let's take this example code: #include <stdio.h> int main(void){ int x = 1; if(*(char
int main(void) { char testStr[50] = Hello, world!; char revS[50] = testStr; } I
int main(void) { char *p = hello; char *q = world; *p = *q;

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.