title: What is the meaning of `printf("%p")` without arguments
body: <p>I of course know it used to output pointer with arguments.</p>
  
  <p>I read book <em>Writing Secure Code</em> by Michael Howard and David LeBlanc.</p>
  
  <p>One program in book demonstrates how stack overflow works by <code>strcpy()</code></p>
  
  <p>Note <code>printf()</code> without arguments.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  void foo(const char* input)
  {
      char buf[10];
  
      //What? No extra arguments supplied to printf?
      //It's a cheap trick to view the stack 8-)
      //We'll see this trick again when we look at format strings.
      printf("My stack looks like:\n%p\n%p\n%p\n%p\n%p\n% p\n\n");
  
      //Pass the user input straight to secure code public enemy #1.
      strcpy(buf, input);
      printf("%s\n", buf);
  
      printf("Now the stack looks like:\n%p\n%p\n%p\n%p\n%p\n%p\n\n");
  }
  
  void bar(void)
  {
      printf("Augh! I've been hacked!\n");
  }
  
  int main(int argc, char* argv[])
  {
      //Blatant cheating to make life easier on myself
      printf("Address of foo = %p\n", foo);
      printf("Address of bar = %p\n", bar);
      if (argc != 2) 
      {
          printf("Please supply a string as an argument!\n");
          return -1;
          } 
      foo(argv[1]);
      return 0;
  }
  </code></pre>
  
  <p>The result is </p>
  
  <pre><code>C:\Secureco2\Chapter05&gt;StackOverrun.exe Hello
  Address of foo = 00401000
  Address of bar = 00401045
  My stack looks like:
  00000000
  00000000
  7FFDF000
  0012FF80 
  0040108A &lt;-- return address
  00410EDE
  
  Hello
  Now the stack looks like:
  6C6C6548 &lt;-- 'l','l','e','h'
  0000006F &lt;-- 0, 0, 0, 'o'
  7FFDF000
  0012FF80
  0040108A
  00410EDE
  </code></pre>
  
  <p>What is the meaning of <code>printf("%p")</code> inside code? Why it can print the content of stack?</p>