I'm new to C and having doubt about the += and ++ operators. Writing
'i += 1' causes the same effect on 'i' as writing '++i' (or 'i++', but
the fetched value will be different). But since 'i += 1' is rather
equivalent to 'i = i + 1', then it is a reassignment, right? So, is
writing '++i' or 'i++' also a reassignment? What is the compiler doing
internally to increment the value in that case? Or is that
implementation-defined behavior?
Thanks,
Sebastian
'i += 1' causes the same effect on 'i' as writing '++i' (or 'i++', but
the fetched value will be different). But since 'i += 1' is rather
equivalent to 'i = i + 1', then it is a reassignment, right? So, is
writing '++i' or 'i++' also a reassignment? What is the compiler doing
internally to increment the value in that case? Or is that
implementation-defined behavior?
Thanks,
Sebastian
Comment