if(&tiles[i]==NULL) printf("Error al abrir una imagen\n"); should read if(tiles[i] == NULL) { ... } Best place to read up on this is in the C Faq (Steve Summit)