This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

what will happen if printf() function is used ?

Dear All,

In my coding , by mistaken i used printf() function instead of sprintf()....
but my code compile ....but not running....

but after replacing sprintf() function ....my code is working fine.

Can any explain be what happen?

Thanks in Advance.

Parents
  • but my code compile

    That's hardly surprising. The C programming language enforces very few restrictions on the code, so there are plenty of ways to shoot yourself in the foot.

    ....but not running....

    You mean 'doesn't work as expected'? That's not surprising either, since you said that you made a typo in the source code. The fact that the compiler accepts your code doesn't mean that the code will behave as expected.

    Can any explain be what happen?

    Apparently, you expected something different to happen. What did you expect?

Reply
  • but my code compile

    That's hardly surprising. The C programming language enforces very few restrictions on the code, so there are plenty of ways to shoot yourself in the foot.

    ....but not running....

    You mean 'doesn't work as expected'? That's not surprising either, since you said that you made a typo in the source code. The fact that the compiler accepts your code doesn't mean that the code will behave as expected.

    Can any explain be what happen?

    Apparently, you expected something different to happen. What did you expect?

Children