How to echo the_title from an array of posts?

try to use get_posts instead , as I read in http://codex.wordpress.org/Function_Reference/query_posts

you can use this code:

global $post;
$args = array('posts_per_page' =>3,'category' => 3 );
$myposts = get_posts( $args );

foreach( $myposts as $post ) :
  setup_postdata($post); 
  the_title()
endforeach; 
wp_reset_postdata();

Regard’s.