above code gives 'March' as output. can anyone explain the reason for it. Also how can i use it to write a program which takes a number(1-12) as input and print corresponding month.
You're doing code tags wrong. The code goes inside them, not after them ;P
can anyone explain the reason for it.
You're using it wrong. The 4th parameter should be a pointer to a tm struct. You're giving it a pointer to a C string. It's probably just reading random garbage and interpretting it as 'March'