If you want to initialize a bunch of elements of dynamically allocated array you can do as @Zeus_ told you:
Code:
p[0] = 5;
p[1] = 15;
p[2] = 5;
p[3] = 53;
p[4] = 101;
Or, in C (not C++), with a compiler capable of compiling code compliant to ISO 9989:2011 standard (I am not sure, right now, but I believe ISO 9989:1999 already had compound literals), you can use compound literals, as in:
Code:
int *p = malloc( 5 * sizeof( int ) );
memcpy( p, (int []){ 5, 15, 5, 53, 101 }, 5 * sizeof( int ) );
Notice is easier to just simply do:
Code:
int a[] = { 5, 15, 5, 53, 101 };
But you are asking how to inicialize a dynamic allocated buffer!