I am taking a class in C and I am having a problem bringing an int through scanf. I have to create a function that will check a date in this format (MMDDYY). So I have set up a scanf for the users input and then I bring it into the function.
It works fine unless the date starts with a 0. For example if the date I input is 022804 then when I printf thedate in the function it just outputs 18. I realize what is happening here is that it is reading the date as an octal notation because it starts with a 0, but how do I get it to stop doing that and read it as an integer?
irish 0 Newbie Poster
Dave Sinkula 2,398 long time no c Team Colleague
irish 0 Newbie Poster
Dave Sinkula 2,398 long time no c Team Colleague
irish 0 Newbie Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.