printf and puts
Newbie here .
Whats the difference between 'printf' and 'puts' . Isnt it better to use 'puts' for basic printing of characters as one would'nt have to type \n .
I love the videos here :)
"puts" is definitely quick and convenient! The big difference is that printf has a format string option.
You can also argue that puts is a little safer. If for example, you pass user input into a "printf" or an "sprintf" function on accident such as:
The user can maliciously format the input string and hack your application (exploit a security vulnerability).
Here's a nice wiki page on string vulnerabilities:
Ok , got it . Thank you .
puts also appends a newline to the end of the statement
Welcome to the WiBit.net forums! Check out our terms and features:
Annoy your friends
Is this something you think someone else would enjoy? Is it not for you, but do you know someone who is down with this type of content? Well share away:
This blog is a reminder that cheating in software development can get you into big trouble. Sometimes developers get really really lazy, OR are pressured to write something using overly simplified data structures. Almost every time this happens you are bitten in the butt! Sometimes the problems show up immediately and other times it may take months or years (especially in integrated systems).
- 1 of 78