General data structure implementation in C and Java