| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 23 Jun 2008 19:33:03 IST
|
|
|
why is the declaration int a[n] ; invalid where n is not a constant integer
|
|
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 24 Jun 2008 00:14:28 IST
|
|
|
ya itz
n can b ne integer
like
int ar[5]
so it contains five elmnts max and min it can contain en no. bt less then 5
|
don't walk as if u rule d world
walk as if u dont care who rules d world
-this is knw as attitude
B who u r and say wat u feel ......
coz those who mind don't matter ........
and those who matter dont mind ......... :)
|
this reply: 0 points
(with 0 
in 0 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 24 Jun 2008 00:16:13 IST
|
|
|
ya its the format n u cannot change it............u hv to give some const. value like any no.there in the bracket
|
trying to reach higher than the highest but with controlled ambition |
this reply: 0 points
(with 0 
in 0 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 24 Jun 2008 19:58:59 IST
|
|
|
but how come dynamic arrays are allowed......help me please
|
this reply: 0 points
(with 0 
in 0 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 24 Jun 2008 20:08:00 IST
|
|
|
first of all dynamic arrays are not allowed and
whenever we define an array its size must be constant becoz an array cannot have variable sizes .....
u can do like this..
where u include header files...
#define num 10;
this defines num = 10;
int ar[num];
this is valid or you can use any constant vaue
rate me if usefull.
|
. . . : : | | : : A T U L : : | | : : . . .
||~::~||THE ONLY THING YOU DON'T KNOW IS THAT WHICH YOU DON'T KNOW||~::~|| |
this reply: 4 points
(with 0 
in 2 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 24 Jun 2008 20:15:23 IST
|
|
|
u can keep those brackets empty.
|
this reply: 0 points
(with 0 
in 0 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 25 Jun 2008 18:49:58 IST
|
|
|
This is true for C++ in general.
In JAVA you can even allocate array size dynamically
|
this reply: 0 points
(with 0 
in 0 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 26 Jul 2008 19:40:33 IST
|
|
|
atul ws right or u can do by this logically similar method-
const int n=10; int arr[n];
|
this reply: 0 points
(with 0 
in 0 votes ) [?]
|
|
You have to be logged on to rate
|
|
|
|
|