Gentlemen,
Is it possible to initialize the array at the time of creation??
I mean:

int *a = new int[10]; // here array is only created. I wanna initialize the same too here itself. Is it possible???

jonsca commented: Start your own thread for this -1

Why neg him, he is learning. WTF.

int a [10]= [1,2,3,8,7,19,15,555,1024,12458]

Peace

WTF

Read the comment. He had tacked this onto another thread. It was assessed in that thread and after that it was split off by a moderator.

I don't see no comment, but ok that explains it nice sig btw.

I don't see no comment

You click the : "Add and View Reputation Comments" link next to the orange dot to see the reputation comment.
And Jonsca is right. This post was originally piggybacked on another thread when I split it.

@coded_hitec: With what values do you want to "initialize" the array?

commented: Got it all squared away over PM :) +4

Why neg him, he is learning. WTF.

int a [10]= [1,2,3,8,7,19,15,555,1024,12458]

Peace

Sir,
I am asking is it possible to initialize a array which is created dynamically using new operator

Again: Initialize with what?

umm? sorry u need to use curly brackets

int *a = {1,2,3,8,7,19,15,555,1024,12458}

you can substitute the values with variables.

My C++ is rather old but this should work.

>> My C++ is rather old but this should work.
Sorry but that will not work either. Consider compiling the code that you post. Even if you are posting minimal snippets/one-liners.

@coded_hitec I believe the answer to your question is "no" but I would be happy to be corrected.

Yeah,
I checked it out at various sources and the answer is no only

thanks for your efforts sir

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.