Is it possible to add and display custom post types to an array?

You just need to use get_post_types() and loop through foreach to get all registered post type.

$post_types = get_post_types( '', 'names' ); 

foreach ( $post_types as $post_type ) {
    echo '<p>' . $post_type . '</p>';
}

See details in WordPress Codex https://codex.wordpress.org/Function_Reference/get_post_types

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)