I need to create several id’s for several structs.
Now I want that each id will start from 00001 to 99999
for example:
- the id of the first struct is 00001
- the id of the second struct is 00002
- …and so on…
Now I need to scanf it, and then printf it so the id that shown in the black window will look like this: The id of the first struct is: 00001
How do I do this?
Do I need to use regular int or double?
And how do i use a loop for (i=0 ; i<99999 ;i++)
while i is the last digits?
Thank you a lot!
For a numerical variable, there is no concept of “leading zeroes”. So if you want to use “0001” in your code, you will have to convert it into a string, adding leading 0’s as required.