0

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???

Votes + Comments
Start your own thread for this
6
Contributors
10
Replies
11
Views
7 Years
Discussion Span
Last Post by coded_hitec
Featured Replies
  • 1

    [QUOTE=finito;1215334]I don't see no comment[/QUOTE] 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" … Read More

0

Why neg him, he is learning. WTF.

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

Peace

0

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.

Edited by jonsca: n/a

1

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?

Votes + Comments
Got it all squared away over PM :)
0

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

-1

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.

0

>> 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.

0

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

0

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

thanks for your efforts sir

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.