title: mixing c and assembly. On the terminal nothing printed
body: <p>I wrote here is a simple code:</p>
  
  <pre><code> printf.asm
  
   [EXTERN main]
   section .text
   global _start     
   _start:
         call main
         add esp, 8
         mov eax, 1
         xor ebx, ebx
         int 80h
  </code></pre>
  
  <p>and main.c</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
   int main()
   {
       char* str = "print from C :\\)";
       printf("%s", str);
   }
  </code></pre>
  
  <p>I compile code like this:</p>
  
  <pre><code>nasm -g -f elf printf.asm -o printf.o
  
  gcc -c -o main.o main.c
  
  ld -o printf printf.o main.o -lc -I/lib/ld-linux.so.2
  </code></pre>
  
  <p>And run:</p>
  
  <pre><code>./printf
  </code></pre>
  
  <p>On the terminal nothing printed. Why ?</p>
  
  <p>when i doing linking with following command <code>ld -Ttext 0x1000 -o printf printf.o main.o -lc -I/lib/ld-linux.so.2</code> , it displays "Killed" string. How to solve this problem ?</p>
  
  <p>Code successfully earned just added a newline character in the printf function: <code>printf("%s\n", str);</code>. Thanks all, the problem is solved.</p>