Code:void a(void) { char x[1]; char y[1]; x = y; } void a(void) { int x[1]; int y[1]; x = y; }
Code:void a(void) { char x[1]; char y[1]; x = y; } void a(void) { int x[1]; int y[1]; x = y; }
No.
.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
so we can't assign an array to anything even, doing x = 5; or x = 'a'; will give an error? we can only assign if we index them?
Yup.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
so doing x[5] = 'a'; is valid but x = y is not?
He already answered that... seriously think before you ask
and if I have :
this is validCode:int x; int y[5]; x = y[2];
You aren't serious are you? Get a book. There are unlimited "is this valid" questions that could be asked, that's not the way to learn.
What about this?
What about THIS?Code:struct S { int A[1]; }; struct S s1 = {1}; struct S s2 = s1;
WHAT ABOUT THIS!!??Code:struct S { int A[1]; float B[1]; }; struct S s1 = {1, 2.0f}; struct S s2 = s1;
Code:struct S { union { struct { int A[1]; }; struct { float B[1]; }; }; }; struct S s1 = {1}; struct S s2 = s1;