title: How to call printf from a C function that I call in the MASM assembler?
body: <p>I have a C file called C.c and for now in that file I have one function that compares two numbers and saves the greater number to the register eax.</p>
  
  <p>I need help with creating the second function that will call <code>printf</code> inside and print some text. How to add support for <code>printf</code> in C that I can call from MASM assembler?</p>
  
  <p>My masm file:</p>
  
  <pre><code>    TITLE MASM Template (main.asm)
  .386
  .model FLAT
  .stack 4096
  
  WriteString PROTO stdcall
  ReadChar PROTO stdcall
  Crlf PROTO stdcall
  ExitProcess PROTO stdcall:DWORD
  greater PROTO C :DWORD, :DWORD
  
  
  .data
  PorukaZaIspis db "Poruka za ispis", 0
  
  .code
  _main PROC
  
  push 8
  push 3
  call greater
  
  
  call Crlf
  mov edx, OFFSET PorukaZaIspis
  call WriteString
  call ReadChar
  Invoke ExitProcess, 0
  _main ENDP
  END _main
  
  END
  </code></pre>
  
  <p>My C.c file:</p>
  
  <pre><code>int greater(int a, int b) {
  if ( a &gt; b)
  return a;
  else 
  return b;
  }
  </code></pre>