I have not found any real code to prepared statement in C for PostgreSQL.
Then I have do it:
prepared_statement.c on CatchChallenger code
Prepare, mean: fix, optimise and cache the execution plan, this prevent any change to execution plan and improve the security too
PS: inspired by http://zetcode.com/db/postgresqlc/