I am learning C-language. The book says:
"initialize a variable when declaring it only if the initial value is part of the semantics of the variable. If the initial value is part of the algorithm, use a separate assignment operator. For example, instead
int price = units * UNIT_PRICE; int gst = price * GST;
Record
int price, gst; price = units * UNIT_PRICE; gst = price * GST;
I do not understand why we should do this? What are the reasons for this?
c coding-style
ipkiss
source share