Code:
int *_esup1;
int *_esup2;
int _nesup[nnode+1]; // Is _nesup initialized?
int _szesup1 = 1;
int CONN[][3] = {{1,2,6},{2,7,6},{2,3,7},{3,8,7},{3,4,8},{4,9,8},{4,5,9},{5,10,9},{7,8,13},{8,12,13},{8,9,12},{9,11,12},{9,10,11}};
_szesup1 = _esup2[nnode]; // _esup2 is not initialized!!!
_esup1 = malloc((sizeof(int))*(_szesup1); // Size in _szesup1 is undefined!!!
//Element pass 2: store the elements in _esup1:
for(_ielem=0; _ielem<=12; _ielem++){
for(_inode=0; _inode<=2; _inode++){
//Update storage counter, storing in _esup1:
_ipoin = CONN[_ielem][_inode];
_istor = _esup2[_ipoin-1] + 1; // [B][COLOR="Red"]_esup2 is not initialized!!!
_esup2[_ipoin-1] = _istor;
_esup1 = malloc((sizeof(int))*(_istor)); // To extend the storage of a block of memory, you must use realloc!
printf("_istor %d\t size(ESUP1) %d\n",_istor, sizeof(_esup1));
_esup1[_istor] = _ielem;
}
}