By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,418 Members | 1,088 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,418 IT Pros & Developers. It's quick & easy.

A question about arrays.

P: n/a
In this function:

int f() {
int A[];
// TODO...
}

What is the use of A? How to assign memory to A? and how to use it later?
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Bilal Sallakh wrote:
In this function:

int f() {
int A[];
// TODO...
}

What is the use of A?
None.
How to assign memory to A?
Not.
and how to use it later?


You can't. The above should produce a compile error. You're trying to
create an array that has no size.

Jul 22 '05 #2

P: n/a
"Bilal Sallakh" <af***@mail2world.com> wrote in message
news:d5**************************@posting.google.c om...
In this function:

int f() {
int A[];
// TODO...
}

What is the use of A?
Invokes translator diagnostic.
How to assign memory to A?
int A[some_constant_expression];

or

int *A = new A[some_size];
and how to use it later?


Use it for what?

Which C++ book(s) are you reading?

-Mike
Jul 22 '05 #3

P: n/a
In turbo C++ from Borland Version 1 1990, a .c file raised a compile
time error while a .cpp file didn't. Is this up to the Compiler used?
Jul 22 '05 #4

P: n/a
If you have a question that is not related to a thread, please don't
post it as reply to it.

Bilal Sallakh wrote:
In turbo C++ from Borland Version 1 1990, a .c file raised a compile
time error while a .cpp file didn't. Is this up to the Compiler used?


Yes.

Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.