We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
%i is Integer. %d is decimal Integer. By default Integer is a decimal. So most of the time you can use either for reading and writing an Integer. However, I should note that for scanf if you precede your decimal integer with a 0 like 024, %i will read it as an octal, not as a decimal. So, the number will be read as 30(octal) and not 24(decimal).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Basic Data Types
You are viewing a single comment's thread. Return to all comments →
%i is Integer. %d is decimal Integer. By default Integer is a decimal. So most of the time you can use either for reading and writing an Integer. However, I should note that for scanf if you precede your decimal integer with a 0 like 024, %i will read it as an octal, not as a decimal. So, the number will be read as 30(octal) and not 24(decimal).