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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:43:36+00:00 2026-06-10T08:43:36+00:00

Consider the really simple code below: #include <stdio.h> #include <stdlib.h> int main() { int*

  • 0

Consider the really simple code below:

#include <stdio.h>
#include <stdlib.h>
int main() {

    int* a = (int*) malloc(10 * sizeof(int));
    printf("a = %p, a+1 = %p", a, a+1);
    return 0;
}

The output is this:

a = 0x127f190, a+1 = 0x127f194

Since the size of an int is 4 bytes, I am assuming from the result above that a pointer value is then the index of a byte on my RAM memory. Hence a+1 increases in fact the value of a by sizeof(int) = 4 (bytes). Is that correct?

If yes, then why do I get 32 bit memory addresses from my program? This machine is 64bit running a 64bit version of Ubuntu. How do I get the program to print a full 64bit address? Do I have to compile it with special flags?

  • 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-10T08:43:38+00:00Added an answer on June 10, 2026 at 8:43 am

    the index of a byte on my RAM memory

    That’s close enough for most purposes, but not entirely accurate. It’s the index of a byte in your process’s address space. Virtual addresses do not relate directly to physical RAM, there’s a thing called a “virtual memory manager” that’s responsible for keeping track of what virtual addresses in each process refer to what physical RAM (and things other than RAM).

    Normally you can forget about this, and just think of the virtual address space as RAM (or as “memory” to keep it abstract). But the same virtual address in different processes could refer to different physical memory, or the same memory could be referred to in different processes by different virtual addresses. Or the same virtual address in the same process could refer to different physical memory at different times, if the OS has noticed that the page hasn’t been used for a while, swapped it to disk and then back to memory when it’s used again. So it’s not really “the” address of the RAM itself, it’s just the address that your process has been given by the OS, to refer to some RAM.

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

Sidebar

Related Questions

Consider this code: #include <iostream> using namespace std; typedef int array[12]; array sample; array
I'm having brainfreeze, and I suspect this one is really simple. Consider this code,
Consider the following code: template <class x1, class x2 = int*> struct CoreTemplate {
Consider the following simple code import java.util.*; public class MainTest<T extends Object1<?,?>> { List<T>
Consider the following code: [<EntryPoint>] let main (args: string []) = let rec main
Let's consider this simple code: <h:form id=myForm> <h:inputText id=myInput> <a4j:support event=onchange actionListener=#{myBean.doSomething}/> </h:inputText> </h:form>
Consider the following simple function void foo_rt(int n) { for(int i=0; i<n; ++i) {
Consider the following C#: // C# .net switch(x) { case 1: for(int i =
Consider the following code: public interface A { public A another(); } public interface
Consider this code: enum { ERR_START, ERR_CANNOTOPENFILE, ERR_CANNOTCONNECT, ERR_CANNOTCONNECTWITH, ERR_CANNOTGETHOSTNAME, ERR_CANNOTSEND, }; char* ERR_MESSAGE[]

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.