Viewing memory location in a C program


#1

In a C program, you can view the memory location using gdb debugger which Cloud9 does uses. Is there a feature in the Cloud9 IDE to view the relative locations of different variables?

For example, I have the following program:
// file: my first program
//

#include <stdio.h>
#include <math.h>

struct FOO {
char a;
char b;
short int c;
short int d;
long e;
float f;
};

int main(int argc, const char** argv) {

FOO joe;

printf(“the address of joe.a is: %p (%u)\n”, &joe.a, (unsigned long)&joe.a);
printf(“the address of joe.b is: %p (%u)\n”, &joe.b, (unsigned long)&joe.b);

printf(“the address of joe.c is: %p (%u)\n”, &joe.c, (unsigned long)&joe.c);
printf(“the address of joe.d is: %p (%u)\n”, &joe.d, (unsigned long)&joe.d);

printf(“the address of joe.e is: %p (%u)\n”, &joe.e, (unsigned long)&joe.e);
printf(“the address of joe.f is: %p (%u)\n”, &joe.f, (unsigned long)&joe.f);

printf(“sizeof FOO = %u bytes\n”, sizeof(joe));
}

The output of the above program is:
the address of joe.a is: 0x7fff44f1bb10 (1156692752)
the address of joe.b is: 0x7fff44f1bb11 (1156692753)
the address of joe.c is: 0x7fff44f1bb12 (1156692754)
the address of joe.d is: 0x7fff44f1bb14 (1156692756)
the address of joe.e is: 0x7fff44f1bb18 (1156692760)
the address of joe.f is: 0x7fff44f1bb20 (1156692768)
sizeof FOO = 24 bytes

Is there a way like a feature in the debugging window or something similar that shows the relative memory locations of all the local variables?