I was wandering why this works:
file1.cpp
file2.cppCode:#include <iostream> struct Point { int a, b; }; void f(Point *); int main(int argc, char *argv[]) { Point a; f(&a); return 0; }
What will happen here?Code:struct Point { int a, b, c; float z; }; void f(Point *p) { p->a = 5; p->b = 5; p->c = 7; p->z = 25.5; }
My compiler doesn't really detects anything.
Edit: the program crashes when i try changing value of z there.
Does this means the programmer has to take care of inconsistent type declarations throughout several files?



LinkBack URL
About LinkBacks



