In case of you're trying to initialize an int *
with
{1,2,3,4,5};
it is wrong because {1,2,3,4,5};
, as-is, is not an array of integers. It is a brace enclosed list of initializer. This can be used to initialize an int
array (individual elements of the array, to be specific), but not a pointer. An array is not a pointer and vice-versa.
However, you can make use of a compound literal to initialize an int *
, like
int * a = (int []){1,2,3,4,5};