I have a question regarding the following lines of code
How can assigning 33.7 to s.x[1] possibly overwrite the functionCode:#include <math.h>
struct st {
double x[1];
double (*func)(double);
};
int main (void) {
struct st s;
s.func = sqrt;
s.x[0] = 1.0;
s.x[1] = 33.7; /* bad */
(void)s.func(s.x[0]);
return 0;
}
pointer? I thought assigning s.x[1]=33.7 was legal because it was within the array boundries.