<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"id":4947,"date":"2022-10-07T05:35:57","date_gmt":"2022-10-07T05:35:57","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=4947"},"modified":"2022-10-07T05:37:01","modified_gmt":"2022-10-07T05:37:01","slug":"explain-break-and-continue-statements-with-examples","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/","title":{"rendered":"Explain break and continue statements with examples"},"content":{"rendered":"<h2 id=\"break\" style=\"text-align: justify;\"><strong>Break<\/strong><\/h2>\n<ul style=\"text-align: justify;\">\n<li>This statement is used with switch statement.<\/li>\n<li>Can also be used with while loop, do \u2013 while loop and for loop.<\/li>\n<li>When the control encounters a break statement, the control will terminate the loop immediately and the statements after break will not be executed.<\/li>\n<\/ul>\n<h3 id=\"syntax\" style=\"text-align: justify;\">Syntax<\/h3>\n<p style=\"text-align: justify;\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-4948 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg\" alt=\"\" width=\"529\" height=\"346\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg 529w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement-300x196.jpg 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement-390x255.jpg 390w\" sizes=\"(max-width: 529px) 100vw, 529px\" \/><\/p>\n<h3 id=\"sample-code\" style=\"text-align: justify;\">Sample Code<\/h3>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">#include&lt;stdio.h&gt;<br\/>int main()<br\/>{<br\/>  <br\/>    int i = 0 , j = 0;<br\/>  <br\/>    \/\/ Iterate a loop over the<br\/>    \/\/ range [0, 5]<br\/>     for(int i = 0 ; i &lt; 5 ; i ++)<br\/>    {<br\/>          printf(\u201ci = %d, j = \u201c, i);<br\/>  <br\/>        \/\/ Iterate a loop over the<br\/>        \/\/ range [0, 5]<br\/>        for(int j = 0 ; j &lt; 5 ; J ++){<br\/>  <br\/>            \/\/ Usage of Break statement<br\/>             If ( j == 2)<br\/>            <br\/>                break;<br\/>             printf(\u201c%d \u201c, j);<br\/>                    }<br\/>  <br\/>        printf(&quot;\\n&quot;);<br\/>    }<br\/>  <br\/>    return 0;<br\/>}<\/code><\/pre> <\/div>\n<h3 id=\"output\" style=\"text-align: justify;\">Output<\/h3>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4949 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/break-statement-in-c.jpg\" alt=\"\" width=\"146\" height=\"164\" \/><\/p>\n<h2 id=\"continue\" style=\"text-align: justify;\"><strong>Continue<\/strong><\/h2>\n<ul style=\"text-align: justify;\">\n<li>This statement is used to bring the control to the beginning of the loop.<\/li>\n<li>The continue statement skips some lines of code inside the loop and continues with the next iteration.<\/li>\n<li>It is mainly used in a program for skiiping certain condition.<\/li>\n<li>This statement does not exit from the loop of the body.<\/li>\n<li>It is not used to exit from the loop body.<\/li>\n<li>Continue statement is not used with switch statement.<\/li>\n<li>It can be used only with while, do while and for loop.<\/li>\n<li>When the control encounters continue statement,control automatically executes the remaining statements of the loop body.<\/li>\n<\/ul>\n<h3 id=\"syntax-2\" style=\"text-align: justify;\">Syntax<\/h3>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4950 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/difference-between-break-and-continue.jpg\" alt=\"\" width=\"559\" height=\"325\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/difference-between-break-and-continue.jpg 559w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/difference-between-break-and-continue-300x174.jpg 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/difference-between-break-and-continue-390x227.jpg 390w\" sizes=\"(max-width: 559px) 100vw, 559px\" \/><\/p>\n<h3 id=\"sample-code-2\" style=\"text-align: justify;\">Sample Code<\/h3>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-c code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-c code-embed-code\">#include &lt;stdio.h&gt;<br\/>  <br\/>\/\/ Driver Code<br\/>int main()<br\/>{<br\/>      Int i = 0 , j = 0 ;<br\/>  <br\/>    \/\/ Iterate the loop over the range[0,5]<br\/>    for (int i = 0; i &lt; 5; i++) {<br\/>         printf(\u201ci = %d, j = \u201c, i);<br\/>        \/\/ Iterate the loop over the range[0,5]<br\/>        For(int j = 0; j &lt; 5 ; j++){  <br\/>         \/\/ Usage of Continue Statement<br\/>            if (j == 2)<br\/>                continue;<br\/>              printf(&quot;%d &quot;, j);<br\/>        }<br\/>            printf(\u201c\\n\u201d);<br\/>            }<br\/>  <br\/>    return 0;<br\/>}<\/code><\/pre> <\/div>\n<h3 id=\"output-2\" style=\"text-align: justify;\">Output<\/h3>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4951 aligncenter\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-continue-statement.jpg\" alt=\"\" width=\"192\" height=\"160\" \/><\/p>\n<p style=\"text-align: justify;\">\n","protected":false},"excerpt":{"rendered":"<p>Break This statement is used with switch statement. Can also be used with while loop, do \u2013 while loop and for loop. When the control encounters a break statement, the control will terminate the loop immediately and the statements after break will not be executed. Syntax Sample Code Output Continue This statement is used to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"footnotes":""},"categories":[1716],"tags":[18835,17796,18838,18834,18832,18837,18833,18839,18831,18836],"class_list":["post-4947","post","type-post","status-publish","format-standard","hentry","category-c","tag-break-and-continue-in-c-programming","tag-break-and-continue-statement-in-c","tag-break-statement-in-c-example","tag-break-vs-continue-in-c","tag-c-break-and-continue","tag-c-break-and-continue-with-examples","tag-c-programming-break-and-continue-statements","tag-continue-statement-in-c-example","tag-difference-between-break-and-continue-statement-in-c","tag-difference-between-break-and-continue-statements-in-c"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Explain break and continue statements with examples<\/title>\n<meta name=\"description\" content=\"Explain break and continue statements with examples - This statement is used with switch statement.Can also be used with while loop, do \u2013 while loop and for loop.\" \/>\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\/explain-break-and-continue-statements-with-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Explain break and continue statements with examples\" \/>\n<meta property=\"og:description\" content=\"Explain break and continue statements with examples - This statement is used with switch statement.Can also be used with while loop, do \u2013 while loop and for loop.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-07T05:35:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-07T05:37:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/\",\"name\":\"Explain break and continue statements with examples\",\"isPartOf\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg\",\"datePublished\":\"2022-10-07T05:35:57+00:00\",\"dateModified\":\"2022-10-07T05:37:01+00:00\",\"author\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"Explain break and continue statements with examples - This statement is used with switch statement.Can also be used with while loop, do \u2013 while loop and for loop.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/#primaryimage\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg\",\"contentUrl\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg\",\"width\":529,\"height\":346},{\"@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\":\"required name=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:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"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":"Explain break and continue statements with examples","description":"Explain break and continue statements with examples - This statement is used with switch statement.Can also be used with while loop, do \u2013 while loop and for loop.","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\/explain-break-and-continue-statements-with-examples\/","og_locale":"en_US","og_type":"article","og_title":"Explain break and continue statements with examples","og_description":"Explain break and continue statements with examples - This statement is used with switch statement.Can also be used with while loop, do \u2013 while loop and for loop.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/","og_site_name":"Wikitechy","article_published_time":"2022-10-07T05:35:57+00:00","article_modified_time":"2022-10-07T05:37:01+00:00","og_image":[{"url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg"}],"author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/","name":"Explain break and continue statements with examples","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg","datePublished":"2022-10-07T05:35:57+00:00","dateModified":"2022-10-07T05:37:01+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"Explain break and continue statements with examples - This statement is used with switch statement.Can also be used with while loop, do \u2013 while loop and for loop.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/c\/explain-break-and-continue-statements-with-examples\/#primaryimage","url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg","contentUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/10\/c-break-statement.jpg","width":529,"height":346},{"@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":"required name=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:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","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\/4947","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=4947"}],"version-history":[{"count":2,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4947\/revisions"}],"predecessor-version":[{"id":4953,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4947\/revisions\/4953"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=4947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=4947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=4947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}