Mark McIntyre said:
Yes, its a derived type. Your disagreement is senseless by the way.
You said an array is not a type. In fact, an array is a type. More
precisely, an array type is a type. I assumed that by "an array", you
meant "an array type"; if you meant something else, please clarify.
I disagreed because you made a false statement. I see nothing
"senseless" about that.
I suspect that you *meant* something different, but I'm not going to
guess what it might have been; I can only respond to what you actually
write.
For example,
"int[4]" is a type, "array of 4 ints".
Both array types and structure types are derived types; assignment is
defined for structure types, but not for array types.
Really?
Yes, really.
Can you say , given some suitable definition of a struct with
two integer members
ss = {4, 5};
?
No, because {4, 5} is not an expression of a struct type. That has
nothing to do with whether assignment is defined for structure types.
It is defined.
Try this:
#include <stdio.h>
int main(void)
{
struct foo { int x; int y; };
struct foo obj1 = { 4, 5 };
/*
* { 4, 5 } is a valid initializer, though it's not a valid
* expression
*/
struct foo obj2;
obj2 = obj1;
/*
* The above statement is an assignment.
* Now let's verify that it worked.
*/
printf("obj2.x = %d, obj2.y = %d\n", obj2.x, obj2.y);
return 0;
}
My suspicion is that this program doesn't tell you anything you don't
already know perfectly well.
Mark, you could save us all a great deal of time and trouble if, every
now and then, you'd just admit when you've made a mistake. Instead,
when you make a sloppy and incorrect statement (which we all do now
and then), you respond to corrections by insisting that you were right
and it's our fault for not understanding you. It's tiresome.