I have a question on my handout for class that says:

Justify / refute the statement that theese declarations are equivalent.
double speed[1] ;
double speed;

My guess was they are the same, since, even though speed[1] is an array, it is the same size of just speed.

Am I wrong?

Recommended Answers

All 2 Replies

they are indeed different because one is an array and the other is not -- their size has nothing to do with it.

>Am I wrong?
Yes, they're different in pretty much every way due to the differing syntax and semantics of scalars and arrays. You can't even say that they have the same storage costs because arrays are allowed to use extra space before and after the accessible items.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.