The result of 512*1024 becomes 0

Thank you for everyone.

I understand the following.

"int * int" result becomes int.
This time, as a result of overflow result became 0.

To avoid this, casting is useful.
As a result of cast, "long * int" result becomes long.
This solved the problem.

Thank you!