I just looked at your program very briefly. I'm always a little wary of malloc commands in a CIN. You are not allocating a great deal of memory, you might just want to declare thos arrays as local variables. If you are going to use malloc, make sure you check for null pointers. Besides that, make sure that when you get results back, that the results make sense. If they don't, it might mean that you are not referencing LV variables correctly, or that you have some alignment issues (LV uses struct packing of 1 and it is sometimes a factor)