{"id":4960,"date":"2022-10-07T06:46:38","date_gmt":"2022-10-07T06:46:38","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=4960"},"modified":"2022-10-07T06:46:38","modified_gmt":"2022-10-07T06:46:38","slug":"what-is-the-difference-between-puts-and-printf","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/","title":{"rendered":"What is the difference between puts() and printf() ?"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-4961\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf.jpg\" alt=\"\" width=\"933\" height=\"426\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf.jpg 933w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf-300x137.jpg 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf-768x351.jpg 768w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf-390x178.jpg 390w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf-820x374.jpg 820w\" sizes=\"(max-width: 933px) 100vw, 933px\" \/><\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"177\">\n<p style=\"text-align: center;\"><strong>Printf()<\/strong><\/p>\n<\/td>\n<td width=\"177\">\n<p style=\"text-align: center;\"><strong>Puts()<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"177\">Declared in the header file stdio.h<\/td>\n<td width=\"177\">Declared in the header file stdio.h<\/td>\n<\/tr>\n<tr>\n<td width=\"177\">Function to print a formatted string to the standard output stream which is the computer screen.<\/td>\n<td width=\"177\">This function prints string on the output stream with a new line character.<\/td>\n<\/tr>\n<tr>\n<td width=\"177\">Syntax for printf is printf(str)<\/td>\n<td width=\"177\">Syntax for puts() is : puts(str)<\/td>\n<\/tr>\n<tr>\n<td width=\"177\">Does not move the cursor to the next line.<\/td>\n<td width=\"177\">Moves the cursor to the next line.<\/td>\n<\/tr>\n<tr>\n<td width=\"177\">Implementation of printf is complicated.<\/td>\n<td width=\"177\">Implementation of puts() is very simpler than printf()<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Printf() Puts() Declared in the header file stdio.h Declared in the header file stdio.h Function to print a formatted string to the standard output stream which is the computer screen. This function prints string on the output stream with a new line character. Syntax for printf is printf(str) Syntax for puts() is : puts(str) Does [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1716],"tags":[18872,18868,18871,18874,18873,18866,18870,18869,18867,18865],"class_list":["post-4960","post","type-post","status-publish","format-standard","hentry","category-c","tag-difference-between-gets-and-scanf","tag-difference-between-printf-and-puts","tag-difference-between-printf-and-puts-in-c","tag-difference-between-puts-and-print","tag-puts-function-in-c","tag-puts-vs-printf","tag-puts-vs-printf-for-printing-a-string","tag-puts-vs-printf-for-printing-a-string-in-c","tag-what-is-the-difference-between-printf-and-puts-in-c","tag-what-is-the-difference-between-puts-and-printf"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is the difference between puts() and printf() ?<\/title>\n<meta name=\"description\" content=\"What is the difference between puts() and printf() ? - puts() vs printf() - Declared in the header file stdio.h -\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is the difference between puts() and printf() ?\" \/>\n<meta property=\"og:description\" content=\"What is the difference between puts() and printf() ? - puts() vs printf() - Declared in the header file stdio.h -\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-07T06:46:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf.jpg\" \/>\n<meta name=\"author\" content=\"webmaster\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webmaster\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/\"},\"author\":{\"name\":\"webmaster\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\"},\"headline\":\"What is the difference between puts() and printf() ?\",\"datePublished\":\"2022-10-07T06:46:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/\"},\"wordCount\":96,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/puts-printf.jpg\",\"keywords\":[\"difference between gets and scanf\",\"difference between printf and puts\",\"difference between printf and puts in c\",\"difference between puts and print\",\"puts() function in c\",\"puts() vs printf()\",\"puts() vs printf() for printing a string\",\"puts() vs printf() for printing a string in c\",\"what is the difference between printf and puts in c\",\"What is the difference between puts() and printf() ?\"],\"articleSection\":[\"C\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/\",\"name\":\"What is the difference between puts() and printf() ?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/puts-printf.jpg\",\"datePublished\":\"2022-10-07T06:46:38+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"What is the difference between puts() and printf() ? - puts() vs printf() - Declared in the header file stdio.h -\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/c\\\/what-is-the-difference-between-puts-and-printf\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/puts-printf.jpg\",\"contentUrl\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/puts-printf.jpg\",\"width\":933,\"height\":426},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\",\"name\":\"webmaster\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"caption\":\"webmaster\"},\"sameAs\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\"],\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/webmaster\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is the difference between puts() and printf() ?","description":"What is the difference between puts() and printf() ? - puts() vs printf() - Declared in the header file stdio.h -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/","og_locale":"en_US","og_type":"article","og_title":"What is the difference between puts() and printf() ?","og_description":"What is the difference between puts() and printf() ? - puts() vs printf() - Declared in the header file stdio.h -","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/","og_site_name":"Wikitechy","article_published_time":"2022-10-07T06:46:38+00:00","og_image":[{"url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf.jpg","type":"","width":"","height":""}],"author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/"},"author":{"name":"webmaster","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"headline":"What is the difference between puts() and printf() ?","datePublished":"2022-10-07T06:46:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/"},"wordCount":96,"commentCount":0,"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf.jpg","keywords":["difference between gets and scanf","difference between printf and puts","difference between printf and puts in c","difference between puts and print","puts() function in c","puts() vs printf()","puts() vs printf() for printing a string","puts() vs printf() for printing a string in c","what is the difference between printf and puts in c","What is the difference between puts() and printf() ?"],"articleSection":["C"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/","name":"What is the difference between puts() and printf() ?","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf.jpg","datePublished":"2022-10-07T06:46:38+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"What is the difference between puts() and printf() ? - puts() vs printf() - Declared in the header file stdio.h -","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/what-is-the-difference-between-puts-and-printf\/#primaryimage","url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf.jpg","contentUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/puts-printf.jpg","width":933,"height":426},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4","name":"webmaster","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","caption":"webmaster"},"sameAs":["https:\/\/www.wikitechy.com\/interview-questions"],"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/webmaster\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=4960"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4960\/revisions"}],"predecessor-version":[{"id":4962,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4960\/revisions\/4962"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=4960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=4960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=4960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}