E.push_back(er); // when the program fails, this is where it happens
So that is where you need to look to try and establish why. Either E or er are not valid; but there is no way anyone here can guess which. Also, expressions like er=BA * F * MA.inverse(); do not make it easy. You need to look at BA, F and the result of MA.inverse at the time of the crash.
You mean you can not have the same name in the same scope.
It is routine to carry the same name such as i, j, count etc but they get restricted to
within a local scope as a local variable in a function or unit.
Not like there should be many but global variables obviously can't have the same name.
It is not a limitation. When C was designed there was not thought to be a need for such a feature. But you could still have variables and functions that were limited to specific source modules. And local variables inside functions were hidden from others automatically.
C is highly portable and simple language. But, because of some limitation of C, it is loosing fame.
The main reason behind is, it doesn't support object-oriented programming features. Means-
are not suported by C programming language, that's why C++ is developed.
In object oriented programming languages, encapsulation is used to refer to one of two related but distinct notions, and sometimes to the combination thereof:
- A language mechanism for restricting direct access to some of the object's components.
- A language construct that facilitates the bundling of data with the methods (or other functions) operating on that data.
Opaque structs in C fit at least one of those definitions for abstraction. You could probably make the case that since you'd need to bundle the opaque struct with some subroutines to manipulate it that you're basically writing methods - the only difference is the class keyword and the lack of an implicit *this* pointer.