Sunday, April 13, 2014

Bubble sort
































Well, your C program was probably wrong and you were lucky. You can get away in C (not certain about its derivatives) with doing things wrong. As I recall, if you have back to back arrays declared in a C program.
































E.g. // C array declaration































int a[10];































int b[10];
































Then if you accessed a[10] you would be getting b[0]. Assuming your type boundaries were correct you would not get a bus error or segmentation violation. This is because C does not do boundary checking on array access.
































Java is much more strict in that aspect.
































Regards,































Jim































































No comments:

Post a Comment