wpdb prepare: passing varible number of fields as second argument

You must use an array for your $vars, so replace

$vars = $a . ', ' .$b . ', ' . c;

with

$vars = array( $a, $b, $c );

But I would rather recommend you to use the $wpdb->insert( $table, $data, $format ) method. Then your code example could look like this:

$data   = array( 'a' => $a, 'b' => $b, 'c' => $c );
$format = array( '%s', '%s', '%s' );

if( empty( $a ) )
{
    $data   = array_slice( $data,   1, 2 );
    $format = array_slice( $format, 1, 2 ); 
} 

$wpdb->insert( $table, $data, $format );