c - What is the address of buf (the local variable in the main function)? -


I had exercise with programming in c or classes and I followed the question:

Is Buf (local variable in main function)? Either enter the answer in hexadecimal format (like 0x 8 "digits" 0-9 or A-F, 0xbfff0014) or in decimal format. Note here that we want the address of the buff, not its content.

The code looks like this:

  int main (int argc, char * argv []) {while (1) {four buff [1024] = {0}; Int r; ....  

I then started the code and put the built code in the buff [1024] line and in Typed Gdb

  p & amp; Buf  

and it gives me results: 0xbffff0f0

But when I use it in this quiz it gives me the result that this value is wrong.

My question is this: Is this the name of the Buff variable (P & E)? Or if not, why not?

Exercise is done on the virtualbox machine, so I think everyone should be the same address

There is no correct numerical answer, the address may vary from one time to another, it is a programming drill that you say the following three statements all gave me the same address.

  printf ("0x% 08x \ n", buf); Printf ("0x% 08x \ n", and buff [0]); Printf ("0x% 08x \ n", and amp; buf);  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -