sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Bilal Sallakh's Avatar

A question about arrays.


Question posted by: Bilal Sallakh (Guest) on July 22nd, 2005 04:48 AM
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?
4 Answers Posted
Rolf Magnus's Avatar
Guest - n/a Posts
#2: Re: A question about arrays.

Bilal Sallakh wrote:
[color=blue]
> In this function:
>
> int f() {
> int A[];
> // TODO...
> }
>
> What is the use of A?[/color]

None.
[color=blue]
> How to assign memory to A?[/color]

Not.
[color=blue]
> and how to use it later?[/color]

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

Mike Wahler's Avatar
Guest - n/a Posts
#3: Re: A question about arrays.

"Bilal Sallakh" <afkar@mail2world.com> wrote in message
news:d5fb3df3.0312010234.45aa1018@posting.google.c om...[color=blue]
> In this function:
>
> int f() {
> int A[];
> // TODO...
> }
>
> What is the use of A?[/color]

Invokes translator diagnostic.
[color=blue]
>How to assign memory to A?[/color]

int A[some_constant_expression];

or

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

Use it for what?

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

-Mike


Bilal Sallakh's Avatar
Bilal Sallakh July 22nd, 2005 04:50 AM
Guest - n/a Posts
#4: Re: A question about arrays.

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?
Rolf Magnus's Avatar
Guest - n/a Posts
#5: Re: A question about arrays.

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

Bilal Sallakh wrote:
[color=blue]
> 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?[/color]

Yes.

 
Not the answer you were looking for? Post your question . . .
196,998 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,998 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors