Can we define an array without any constant expression? If Yes, How?

Showing Answers 1 - 6 of 6 Answers

funkreality

  • Jan 8th, 2008
 

int *a=new int[];
arrays and pointers are similar things .if now you want to access any element just type a[element no] and access the element.

  Was this answer useful?  Yes

prachiti

  • Sep 8th, 2008
 

Yes.

/*Array of Strings*/
char* _animals[] = { "Tiger","Lion", "Dog", "Cat" };

/*Array of ints*/

int numbers[] = {1,2,3,4,5};

number of elements of such arrays can be obtained by
count = (sizeof(_animals)/sizeof(_animals[0]));

  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions