

{"id":120578,"date":"2023-10-30T19:00:34","date_gmt":"2023-10-30T13:30:34","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=120578"},"modified":"2023-10-30T19:13:17","modified_gmt":"2023-10-30T13:43:17","slug":"for-loop-in-c","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/","title":{"rendered":"for Loop in C"},"content":{"rendered":"<p>Loops are a fundamental concept in programming that allows us to repeatedly execute blocks of code for iterative tasks. Without loops, coding anything that requires repetition would be painfully tedious.<\/p>\n<p>C provides several looping constructs, with the humble for loop in C being one of the most ubiquitous. For loops are used extensively in C programming for everything from simple counting and summing to iterating through arrays and complex nested loop structures. Mastering the for loop provides a vital tool for any C coder&#8217;s toolkit.<\/p>\n<h2>Understanding the For Loop in C<\/h2>\n<p>The for loop in C enables iterating through a code block a predetermined number of times. <strong>The basic syntax is:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">for (initialization; condition; increment\/decrement) {\r\n\/\/ statements\r\n}<\/pre>\n<p><strong>Let&#8217;s break this down:<\/strong><\/p>\n<ul>\n<li><strong>Initialization:<\/strong> Used to initialize a counter or loop control variable, typically before entering the loop.<\/li>\n<li><strong>Condition:<\/strong> Evaluated each iteration to check if looping should continue.<\/li>\n<li><strong>Increment\/Decrement:<\/strong> Updates the loop control variable, usually incrementing or decrementing it.<\/li>\n<li><strong>Statements:<\/strong> The code to execute in each iteration as long as the condition remains true.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/09\/for-loop-in-c-programming.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-120735 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/09\/for-loop-in-c-programming.webp\" alt=\"for loop in c programming\" width=\"600\" height=\"400\" \/><\/a><\/p>\n<p>Compared to while and do-while loops, for loops in C, are ideal when you know ahead of time the exact number of iterations needed. The structure ensures control variables are initialized, checked, and updated in an organized manner.<\/p>\n<h3>C For Loop Flow<\/h3>\n<p><strong>The for loop sequence is:<\/strong><\/p>\n<p>1. Initialization runs once before the loop starts.<br \/>\n2. The condition is evaluated.<br \/>\n3. If true, the loop body executes.<br \/>\n4. The update statement updates variables like the counter.<br \/>\n5. The condition is evaluated again.<br \/>\n6. Steps 3-5 repeat until the condition becomes false.<br \/>\n7. When the condition is false, the loop terminates.<\/p>\n<p>This controlled flow makes for loops perfect for predetermined iteration counts.<\/p>\n<h3>C For Loop Structure<\/h3>\n<p><strong>A for loop in C contains four components that control the iterative process:<\/strong><\/p>\n<ul>\n<li><strong>Initialization:<\/strong> Typically initializes a counter variable starting from a desired value. Can initialize multiple variables, too, if required.<\/li>\n<li><strong>Condition:<\/strong> Evaluated each iteration to determine if the loop body should execute. The loop terminates when this becomes false.<\/li>\n<li><strong>Increment\/Decrement:<\/strong> Increments or decrements control variables, usually the counter, after each iteration. Updates their state for the next condition check.<\/li>\n<li><strong>Body Execution:<\/strong> Executes the target code block repeatedly as long as the condition remains true.<\/li>\n<\/ul>\n<h3>How for Loop in C work?<\/h3>\n<ul>\n<li><strong>Initialization:<\/strong> This first step executes only once at the start of the loop, declaring and initializing any variables needed inside the loop.<\/li>\n<li><strong>Condition Check:<\/strong> The loop condition is evaluated next. If the condition holds true, the loop body will be executed. If false, the loop terminates.<\/li>\n<li><strong>Body Execution:<\/strong> If the condition passed, the code inside the loop body is executed. This contains the main logic to repeat each iteration.<\/li>\n<li><strong>Increment\/Update:<\/strong> Variables like counters often need updating after each iteration. The increment section updates its state before the next condition check.<\/li>\n<li><strong>Repeat:<\/strong> After completing the body execution and increment step, the condition is evaluated again. This process repeats, with the body executing each time the condition is true.<\/li>\n<li><strong>Loop Exit:<\/strong> When the condition becomes false, the loop terminates, skipping body execution and picking up from code after the loop.<\/li>\n<\/ul>\n<h3>Example Code Walkthrough<\/h3>\n<h4>Printing Numbers:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n  int i;\r\n\r\n  for (i = 1; i &lt;= 5; i++) { \r\n    printf(\"%d \", i);  \r\n  }\r\n\r\n  return 0;\r\n}<\/pre>\n<p><strong>\/\/ Output:<\/strong> 1 2 3 4 5<\/p>\n<p>The initialization sets i to 1. The test condition checks if i &lt;= 5. Inside the loop body, i is printed and incremented by 1. This repeats until i becomes 6, making the condition false.<\/p>\n<h4>Multiplication Table:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n  \r\n  int i, num;\r\n\r\n  num = 5;\r\n\r\n  for(i = 1; i &lt;= 10; i++) {\r\n    printf(\"%d x %d = %d\\n\", num, i, num*i);\r\n  }\r\n\r\n  return 0;\r\n}<\/pre>\n<p><strong>\/\/ Output:<\/strong><br \/>\n\/\/ 5 x 1 = 5<br \/>\n\/\/ 5 x 2 = 10<br \/>\n\/\/ 5 x 3 = 15<br \/>\n\/\/ &#8230;<br \/>\n\/\/ 5 x 10 = 50<\/p>\n<p>The initialization sets i to 1. The test condition checks if i &lt;= 10. Inside the loop body, i is printed and incremented by 1. This repeats until i become 11, making the condition false.<\/p>\n<h4>Sum of Numbers:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n\r\n  int i, sum = 0;\r\n\r\n  for(i = 1; i &lt;= 10; i++) {\r\n    sum += i;\r\n  }\r\n\r\n  printf(\"Sum = %d\", sum);\r\n\r\n  return 0; \r\n}<\/pre>\n<p><strong>\/\/ Output:<\/strong> Sum = 55<\/p>\n<p>This accumulates the sum of numbers from 1 to 10 by incrementing i and adding it to sum each iteration. The loop exits once i is 11.<\/p>\n<p>These examples demonstrate simple yet powerful ways to put for loops to work.<\/p>\n<h4>Multiple Initialization:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n\r\n  int a, b, c;\r\n\r\n  for(a=0, b=10, c=20; a&lt;5; a++) {\r\n    printf(\"%d %d %d\\n\", a, b, c);\r\n  }\r\n  \r\n  return 0;\r\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p>0 10 20<br \/>\n1 10 20<br \/>\n2 10 20<br \/>\n3 10 20<br \/>\n4 10 20<\/p>\n<h4>Factorial Program:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n  int num, factorial = 1;\r\n\r\n  printf(\"Enter a number: \");\r\n  scanf(\"%d\", &amp;num);\r\n\r\n  for(int i=1; i&lt;=num; i++) {\r\n    factorial *= i;\r\n  }\r\n\r\n  printf(\"Factorial of %d is %d\", num, factorial);\r\n  \r\n  return 0;\r\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><strong>Enter a number:<\/strong> 5<br \/>\nFactorial of 5 is 120<\/p>\n<h4>Prime Number Program:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n\r\n  int num, flag=0;\r\n\r\n  printf(\"Enter a number: \");\r\n  scanf(\"%d\", &amp;num);\r\n\r\n  for(int i=2; i&lt;=num\/2; i++) {\r\n    if(num%i == 0) {\r\n      flag = 1;\r\n      break;\r\n    }\r\n  }\r\n\r\n  if (flag==0) {\r\n    printf(\"%d is a prime number.\", num);\r\n  } else {\r\n    printf(\"%d is not a prime number.\", num);\r\n  }\r\n  \r\n  return 0;\r\n}<\/pre>\n<p><strong>Enter a number:<\/strong> 13<br \/>\n13 is a prime number.<\/p>\n<h4>Fibonacci Series:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n\r\n  int n, t1 = 0, t2 = 1, nextTerm;\r\n\r\n  printf(\"Enter the number of terms: \");\r\n  scanf(\"%d\", &amp;n);\r\n\r\n  for (int i = 1; i &lt;= n; ++i) {\r\n    printf(\"%d, \", t1);\r\n    nextTerm = t1 + t2;\r\n    t1 = t2;\r\n    t2 = nextTerm;\r\n  }\r\n\r\n  return 0;\r\n}<\/pre>\n<p><strong>Enter the number of terms:<\/strong> 10<br \/>\n0, 1, 1, 2, 3, 5, 8, 13, 21, 34,<\/p>\n<h3>Advanced Usages<\/h3>\n<p>For loops can execute more complex tasks through nested loops, loop control statements, and by iterating through arrays.<\/p>\n<p><strong>Nested Loops:<\/strong> A for loop inside another for loop enables advanced iteration logic.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">for( .. ; .. ; .. ){\r\n    for( .. ; .. ; .. ){\r\n        ....\r\n    }\r\n}<\/pre>\n<p><strong>Loop Control:<\/strong> continue skips current iteration, while break exits the loop immediately.<\/p>\n<p><strong>Arrays: f<\/strong>or loops, can sequentially process array elements.<\/p>\n<p>Overall, loops provide a versatile way to implement all kinds of iteration scenarios.<\/p>\n<h3>Special Cases<\/h3>\n<p>For loops can be constructed in some unique ways to alter their usual flow and behavior. Let&#8217;s explore two interesting special cases for for loops in C.<\/p>\n<h4>1) Single Statement Loop Body<\/h4>\n<p><strong>For loop bodies are generally defined inside braces, but if the body simply contains one statement, the braces can be skipped:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\n\r\nint main() {\r\n\r\n  int i;\r\n\r\n  for (i = 1; i &lt;= 5; i++)\r\n    printf(\"DataFlair provides great C programming tutorials! \\n\");\r\n\r\n  return 0; \r\n}<\/pre>\n<p><strong>\/\/ Output:<\/strong><br \/>\n\/\/ DataFlair provides great C programming tutorials!<br \/>\n\/\/ DataFlair provides great C programming tutorials!<br \/>\n\/\/ DataFlair provides great C programming tutorials!<br \/>\n\/\/ DataFlair provides great C programming tutorials!<br \/>\n\/\/ DataFlair provides great C programming tutorials!<\/p>\n<p>Here, the printf statement will execute 5 times. This can make simple loops more concise. However, caution is required, as forgetting the braces when you add more statements can cause unexpected behavior.<\/p>\n<h4>2) Infinite Loop<\/h4>\n<p><strong>It is possible to intentionally create an infinite for loop by omitting all three components &#8211; initialization, condition, and increment:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;stdio.h&gt;\r\nint main() {\r\n  int count = 0;\r\n\r\n  for ( ; ; ) {\r\n    printf(\"In infinite loop\\n\");\r\n    \r\n    count++;\r\n    if(count == 5) {\r\n      break;\r\n    }\r\n  }\r\n\r\n  return 0;\r\n}<\/pre>\n<p><strong>\/\/ Output:<\/strong><br \/>\n\/\/ In infinite loop<br \/>\n\/\/ In infinite loop<br \/>\n\/\/ In infinite loop<br \/>\n\/\/ In infinite loop<br \/>\n\/\/ In infinite loop<br \/>\n\u2026\u2026<\/p>\n<p>This can be useful when you have termination logic, like break statements within the loop, and want it to run continuously otherwise. But use with caution to avoid freezes!<\/p>\n<h3>Common Mistakes<\/h3>\n<p><strong>Watch out for these common C for loop pitfalls:<\/strong><\/p>\n<ul>\n<li>Forgetting to update conditions causes infinite loops.<\/li>\n<li>Using = instead of == in condition checking.<\/li>\n<li>Initializing variables in the wrong scope.<\/li>\n<\/ul>\n<p>Use print debugging and IDE debugging features to identify issues. Start simple and slowly add complexity.<\/p>\n<h3>Pros of Using For Loops in C<\/h3>\n<p><strong>C For loops offer several benefits:<\/strong><\/p>\n<ul>\n<li><strong>Reusable Code &#8211;<\/strong> The structured for loop syntax lends itself well to creating reusable code blocks for repetitive tasks.<\/li>\n<li><strong>Compact Size &#8211;<\/strong> Handling the loop variable and iteration inside the for statement keeps the overall code compact.<\/li>\n<li><strong>Data Structure Traversal &#8211;<\/strong> For loops make iterating through arrays, strings, and other data structures simpler and more readable.<\/li>\n<\/ul>\n<h3>Cons of Using For Loops in C<\/h3>\n<p><strong>However, C for loops also come with a few disadvantages:<\/strong><\/p>\n<ul>\n<li><strong>No Element Skipping &#8211;<\/strong> For loops in C do not provide an easy way to skip iterations or access non-contiguous elements like some while loops.<\/li>\n<li><strong>Single Condition &#8211;<\/strong> Complex conditional logic inside for loop bodies can get unwieldy compared to implementing in while or do-while loops.<\/li>\n<\/ul>\n<h3>Comparing For and While Loops in C<\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>Feature<\/b><\/td>\n<td><b>For Loop<\/b><\/td>\n<td><b>While Loop<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Structure<\/span><\/td>\n<td><span style=\"font-weight: 400\">More structured syntax with initialization, condition, and increment\/decrement handled in one line<\/span><\/td>\n<td><span style=\"font-weight: 400\">Syntax only includes a condition with the loop body code in braces<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Readability<\/span><\/td>\n<td><span style=\"font-weight: 400\">Clear separation of initialization, condition, and iteration control makes logic easy to read.<\/span><\/td>\n<td><span style=\"font-weight: 400\">Requires reading code in loop body to understand initialization and iteration<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Iteration Control<\/span><\/td>\n<td><span style=\"font-weight: 400\">Initialization, condition check, and iteration are handled automatically by the for loop syntax.<\/span><\/td>\n<td><span style=\"font-weight: 400\">The programmer must handle all initialization, conditional checking, and iteration control in loop body.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Loop Count<\/span><\/td>\n<td><span style=\"font-weight: 400\">Designed for loops with a predetermined number of iterations<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is better for loops where exit condition depends on factors inside the loop<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Performance<\/span><\/td>\n<td><span style=\"font-weight: 400\">The overhead of checking conditions each iteration<\/span><\/td>\n<td><span style=\"font-weight: 400\">Condition check only when required inside loop body<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Conclusion<\/h3>\n<p>For loops are an essential and versatile construct in the C programming language. Their inherent structure promotes organized, readable code by handling initialization, conditional checking, and iteration in a single line. By mastering the for loop, C programmers gain precise control over iterating through code blocks a predetermined number of times. Used properly, for loops in C can simplify repetitive tasks, process arrays, and create complex nested looping systems. Though simple in syntax, the utility of the for loop within C code is immense. Equipped with this fundamental tool, C coders can build efficient solutions to tackle all kinds of programming challenges.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Loops are a fundamental concept in programming that allows us to repeatedly execute blocks of code for iterative tasks. Without loops, coding anything that requires repetition would be painfully tedious. C provides several looping&#46;&#46;&#46;<\/p>\n","protected":false},"author":581,"featured_media":120580,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19488],"tags":[23914,20289,28337],"class_list":["post-120578","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-programming","tag-c-programming","tag-for-loop-in-c","tag-loop-in-c"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>for Loop in C - DataFlair<\/title>\n<meta name=\"description\" content=\"For loop in C is used for simple counting and summing to iterating through arrays and complex nested loop structures.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"for Loop in C - DataFlair\" \/>\n<meta property=\"og:description\" content=\"For loop in C is used for simple counting and summing to iterating through arrays and complex nested loop structures.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-30T13:30:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-30T13:43:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/09\/for-loop-in-c.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"for Loop in C - DataFlair","description":"For loop in C is used for simple counting and summing to iterating through arrays and complex nested loop structures.","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:\/\/data-flair.training\/blogs\/for-loop-in-c\/","og_locale":"en_US","og_type":"article","og_title":"for Loop in C - DataFlair","og_description":"For loop in C is used for simple counting and summing to iterating through arrays and complex nested loop structures.","og_url":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-10-30T13:30:34+00:00","article_modified_time":"2023-10-30T13:43:17+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/09\/for-loop-in-c.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445"},"headline":"for Loop in C","datePublished":"2023-10-30T13:30:34+00:00","dateModified":"2023-10-30T13:43:17+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/"},"wordCount":1322,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/09\/for-loop-in-c.webp","keywords":["c programming","For loop in C","loop in c"],"articleSection":["C Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/for-loop-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/","url":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/","name":"for Loop in C - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/09\/for-loop-in-c.webp","datePublished":"2023-10-30T13:30:34+00:00","dateModified":"2023-10-30T13:43:17+00:00","description":"For loop in C is used for simple counting and summing to iterating through arrays and complex nested loop structures.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/for-loop-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/09\/for-loop-in-c.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/09\/for-loop-in-c.webp","width":1200,"height":628,"caption":"for loop in c"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/for-loop-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"C Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/c-programming\/"},{"@type":"ListItem","position":3,"name":"for Loop in C"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam6\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/120578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=120578"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/120578\/revisions"}],"predecessor-version":[{"id":123194,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/120578\/revisions\/123194"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/120580"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=120578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=120578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=120578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}