Receiving connection timeout error when call PQconnectdbParams to connect to Postgres
You are mixing up the different connection functions.

Your call would be correct with PQconn. PQconnectdbParams takes two parameters per connection string keyword

Replace PQconnectdbParams with PQconn and you should be fine.