A question about arrays.

B

Bilal Sallakh

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

Rolf Magnus

Bilal said:
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.
 
M

Mike Wahler

Bilal Sallakh said:
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
 
B

Bilal Sallakh

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

Rolf Magnus

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

Bilal said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,148
Messages
2,570,838
Members
47,385
Latest member
Joneswilliam01

Latest Threads

Top