Probably , it prints the pointer size , because as you know if you refere array name , it is hold array's zero base adress.
If you want to find the array size you have to iterate.
It all shows the same, because name of an array is a pointer to its first element. SIZEs of types of variables may be different in comparison with another computers and for your PC both long and double eat the same portion of memory. So when you write sizeof(row_ptr) and sizeof(val) it's the same as if you write sizeof(long) or sizeof(double)
But I think there is no way to determine size of dynamically allocated array (vectors are recommended)
Ah, it's part of a (very long) assignment to return the size. I'll just assume I have to return sizeof the pointer type, * the size of the array, as that's all I really can do I guess.