{"id":6583,"date":"2022-09-04T03:29:34","date_gmt":"2022-09-03T21:59:34","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/"},"modified":"2022-09-04T03:29:34","modified_gmt":"2022-09-03T21:59:34","slug":"solved-how-to-print-cities-correctly-using-recursive-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/","title":{"rendered":"[Solved] How to print cities correctly using recursive? [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-61123181\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"61123181\" data-parentid=\"61121258\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>very probably a reasonable definition of <em>cities<\/em> (which was much better named <em>City<\/em>, no reason so have it plural) is<\/p>\n<pre><code>typedef struct cities {\n  char name[64];\n  struct cities * e;\n  struct cities * n;\n  struct cities * s;\n  struct cities * w;\n} cities;\n<\/code><\/pre>\n<p>and your problem is to write all the links without entering in an infinite loop<\/p>\n<p>A first thing to do is to immediately modify your program because you indicate the west etc of a city but you do not indicate for which city, so for instance :<\/p>\n<pre><code>  if(cityHead-&gt;w != NULL &amp;&amp; w != 1){\n      printf(\"--\");\n      printf(\"%s West: %s\\n\", cityHead-&gt;name, cityHead-&gt;w-&gt;name);\n      printcity(cityHead-&gt;w,1,0,0,0);\n  }else{\n      printf(\"--\");\n      printf(\"%s West: None\\n\", cityHead-&gt;name);\n  }\n<\/code><\/pre>\n<p>and so on for the other cases<\/p>\n<p>Let see with 2 cities with the change :<\/p>\n<pre><code>int main()\n{\n  cities * c1 = newcity(\"c1\");\n  cities * c2 = newcity(\"c2\");\n\n  c1-&gt;e = c2;\n  c2-&gt;w = c1;\n\n  printcity(c1, 0, 0, 0, 0);\n}\n<\/code><\/pre>\n<p>Execution :<\/p>\n<pre><code>pi@raspberrypi:\/tmp $ .\/a.out\n--c1 West: None\n--c1 East: c2\n--c2 West: None\n--c2 East: None\n--c2 South: None\n--c2 North: None\n--c1 South: None\n--c1 North: None\n<\/code><\/pre>\n<p>and we see the program does not indicate the east of <em>c2<\/em> is <em>c1<\/em><\/p>\n<p>The reason is simple, for instance in<\/p>\n<blockquote>\n<pre><code> if(cityHead-&gt;w != NULL &amp;&amp; w != 1){\n     printf(\"--\");\n     printf(\"%s West: %s\\n\", cityHead-&gt;name, cityHead-&gt;w-&gt;name);\n     printcity(cityHead-&gt;w,1,0,0,0);\n }else{\n     printf(\"--\");\n     printf(\"%s West: None\\n\", cityHead-&gt;name);\n }\n<\/code><\/pre>\n<\/blockquote>\n<p><em>w<\/em> is clearly used to not enter in an infinite, but it also blocks the  <em>printf<\/em><\/p>\n<p>So let modify it to have :<\/p>\n<pre><code>  if(cityHead-&gt;w != NULL){\n      printf(\"--\");\n      printf(\"%s West: %s\\n\", cityHead-&gt;name, cityHead-&gt;w-&gt;name);\n      if (w != 1)\n        printcity(cityHead-&gt;w,1,0,0,0);\n  }else{\n      printf(\"--\");\n      printf(\"%s West: None\\n\", cityHead-&gt;name);\n  }\n<\/code><\/pre>\n<p>There is also an error when you want to manage the north, the recursive call is :<\/p>\n<blockquote>\n<pre><code>printcity(cityHead-&gt;s,0,0,1,0);\n<\/code><\/pre>\n<\/blockquote>\n<p>but it must be<\/p>\n<pre><code>printcity(cityHead-&gt;n,0,0,1,0);\n<\/code><\/pre>\n<p>So finaly :<\/p>\n<pre><code>void printcity(cities *cityHead,int e,int w,int s,int n){\n if(cityHead){\n\n    if(cityHead-&gt;w != NULL){\n        printf(\"--\");\n        printf(\"%s West: %s\\n\", cityHead-&gt;name, cityHead-&gt;w-&gt;name);\n        if (w != 1)\n          printcity(cityHead-&gt;w,1,0,0,0);\n    }else{\n        printf(\"--\");\n        printf(\"%s West: None\\n\", cityHead-&gt;name);\n    }\n\n    if(cityHead-&gt;e != NULL){\n        printf(\"--\");\n        printf(\"%s East: %s\\n\", cityHead-&gt;name,cityHead-&gt;e-&gt;name);\n        if (e != 1)\n          printcity(cityHead-&gt;e,0,1,0,0);\n\n    }else{\n        printf(\"--\");\n        printf(\"%s East: None\\n\", cityHead-&gt;name);\n    }\n\n    if(cityHead-&gt;s != NULL){\n        printf(\"--\");\n        printf(\"%s South: %s\\n\", cityHead-&gt;name,cityHead-&gt;s-&gt;name);\n        if (s != 1)\n          printcity(cityHead-&gt;s,0,0,0,1);\n\n    }else{\n        printf(\"--\");\n        printf(\"%s South: None\\n\", cityHead-&gt;name);\n    }\n\n    if(cityHead-&gt;n != NULL){\n        printf(\"--\");\n        printf(\"%s North: %s\\n\", cityHead-&gt;name,cityHead-&gt;n-&gt;name);\n        if (n != 1)\n          printcity(cityHead-&gt;n,0,0,1,0);\n\n    }else{\n        printf(\"--\");\n        printf(\"%s North: None\\n\", cityHead-&gt;name);\n    }\n }\n}\n<\/code><\/pre>\n<p>out of that let notice the initial test<\/p>\n<blockquote>\n<pre><code>if(cityHead){\n<\/code><\/pre>\n<\/blockquote>\n<p>is only useful if <em>printcity<\/em> is initially called with NULL, the function itself never recur with a NULL<\/p>\n<p>Now the execution is :<\/p>\n<pre><code>pi@raspberrypi:\/tmp $ .\/a.out\n--c1 West: None\n--c1 East: c2\n--c2 West: c1\n--c2 East: None\n--c2 South: None\n--c2 North: None\n--c1 South: None\n--c1 North: None\n<\/code><\/pre>\n<p>If we have 4 cities making a square :<\/p>\n<pre><code>int main()\n{\n  cities * c1 = newcity(\"c1\");\n  cities * c2 = newcity(\"c2\");\n  cities * c3 = newcity(\"c3\");\n  cities * c4 = newcity(\"c4\");\n\n  c1-&gt;e = c2;\n  c2-&gt;w = c1;\n\n  c1-&gt;s = c3;\n  c3-&gt;n = c1;\n\n  c2-&gt;s = c4;\n  c4-&gt;n = c2;\n\n  c4-&gt;w = c3;\n  c3-&gt;e = c4;\n\n  printcity(c1, 0, 0, 0, 0);\n}\n<\/code><\/pre>\n<p>the execution write a verrrrrrrry long times before to stop after too many recursions and a too large stack.<\/p>\n<p>The reason is the <em>int<\/em> in parameters do not have enough extend in the graph.<\/p>\n<p>A way to solve is to add a field in the <em>struct<\/em> to mark if the city was already managed. But out of modifying the <em>struct<\/em> that requests at the end to again go through the graph to clear the mark.<\/p>\n<p>An other way is to save the already managed cities in a list, giving that list in parameter :<\/p>\n<pre><code>#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;string.h&gt;\n\ntypedef struct cities {\n  char name[64];\n  struct cities * e;\n  struct cities * n;\n  struct cities * s;\n  struct cities * w;\n} cities;\n\ntypedef struct CityList {\n  cities * city;\n  struct CityList * next;\n} CityList;\n\nint isPresent(cities * c, CityList * l)\n{\n  while (l) {\n    if (l-&gt;city == c)\n      return 1;\n    l = l-&gt;next;\n  }\n  return 0;\n}\n\nvoid add(cities * city, CityList ** l)\n{\n  CityList * cell = malloc(sizeof(CityList));\n\n  cell-&gt;city = city;\n  cell-&gt;next = *l;\n  *l = cell;\n}\n\nvoid clear(CityList ** l)\n{\n  while (*l) {\n    CityList * c = *l;\n\n    *l = (*l)-&gt;next;\n    free(c);\n  }\n}\n\n\nvoid printcity(cities *cityHead, CityList ** l){\n if(cityHead &amp;&amp; !isPresent(cityHead, *l)) {\n    add(cityHead, l);\n    if(cityHead-&gt;w != NULL){\n        printf(\"--\");\n        printf(\"%s West: %s\\n\", cityHead-&gt;name, cityHead-&gt;w-&gt;name);\n        printcity(cityHead-&gt;w, l);\n    }else{\n        printf(\"--\");\n        printf(\"%s West: None\\n\", cityHead-&gt;name);\n    }\n\n    if(cityHead-&gt;e != NULL){\n        printf(\"--\");\n        printf(\"%s East: %s\\n\", cityHead-&gt;name,cityHead-&gt;e-&gt;name);\n        printcity(cityHead-&gt;e, l);\n\n    }else{\n        printf(\"--\");\n        printf(\"%s East: None\\n\", cityHead-&gt;name);\n    }\n\n    if(cityHead-&gt;s != NULL){\n        printf(\"--\");\n        printf(\"%s South: %s\\n\", cityHead-&gt;name,cityHead-&gt;s-&gt;name);\n        printcity(cityHead-&gt;s, l);\n\n    }else{\n        printf(\"--\");\n        printf(\"%s South: None\\n\", cityHead-&gt;name);\n    }\n\n    if(cityHead-&gt;n != NULL){\n        printf(\"--\");\n        printf(\"%s North: %s\\n\", cityHead-&gt;name,cityHead-&gt;n-&gt;name);\n        printcity(cityHead-&gt;n, l);\n\n    }else{\n        printf(\"--\");\n        printf(\"%s North: None\\n\", cityHead-&gt;name);\n    }\n }\n}\n\ncities * newcity(char name[])\n{\n   cities *temp = (cities*)malloc(sizeof(cities));\n\n   strcpy(temp-&gt;name,name);\n   temp-&gt;e = temp-&gt;n = temp-&gt;s = temp-&gt;w = NULL;\n   return temp;\n } \n\n\nint main()\n{\n  cities * c1 = newcity(\"c1\");\n  cities * c2 = newcity(\"c2\");\n  cities * c3 = newcity(\"c3\");\n  cities * c4 = newcity(\"c4\");\n  CityList * l = NULL;\n\n  c1-&gt;e = c2;\n  c2-&gt;w = c1;\n\n  c1-&gt;s = c3;\n  c3-&gt;n = c1;\n\n  c2-&gt;s = c4;\n  c4-&gt;n = c2;\n\n  c4-&gt;w = c3;\n  c3-&gt;e = c4;\n\n  puts(\"[]\");\n  printcity(c1, &amp;l);\n  clear(&amp;l);\n\n  \/* to make a 8 *\/\n\n  cities * c5 = newcity(\"c5\");\n  cities * c6 = newcity(\"c6\");\n\n  c3-&gt;s = c5;\n  c5-&gt;n = c3;\n\n  c4-&gt;s = c6;\n  c6-&gt;n = c4;\n\n  c5-&gt;e = c6;\n  c6-&gt;w = c5;\n\n  puts(\"8\");\n  printcity(c1, &amp;l);\n  clear(&amp;l);\n\n  free(c1);\n  free(c2);\n  free(c3);\n  free(c4);\n  free(c5);\n  free(c6);\n\n  return 0;\n}\n<\/code><\/pre>\n<p>Execution :<\/p>\n<pre><code>pi@raspberrypi:\/tmp $ .\/a.out\n[]\n--c1 West: None\n--c1 East: c2\n--c2 West: c1\n--c2 East: None\n--c2 South: c4\n--c4 West: c3\n--c3 West: None\n--c3 East: c4\n--c3 South: None\n--c3 North: c1\n--c4 East: None\n--c4 South: None\n--c4 North: c2\n--c2 North: None\n--c1 South: c3\n--c1 North: None\n8\n--c1 West: None\n--c1 East: c2\n--c2 West: c1\n--c2 East: None\n--c2 South: c4\n--c4 West: c3\n--c3 West: None\n--c3 East: c4\n--c3 South: c5\n--c5 West: None\n--c5 East: c6\n--c6 West: c5\n--c6 East: None\n--c6 South: None\n--c6 North: c4\n--c5 South: None\n--c5 North: c3\n--c3 North: c1\n--c4 East: None\n--c4 South: c6\n--c4 North: c2\n--c2 North: None\n--c1 South: c3\n--c1 North: None\npi@raspberrypi:\/tmp $ \n<\/code><\/pre>\n<hr>\n<p>Note your definition of <em>newcity<\/em> is dangerous because of the line<\/p>\n<blockquote>\n<pre><code>strcpy(temp-&gt;name,name);\n<\/code><\/pre>\n<\/blockquote>\n<p>where you can write out of the field <em>name<\/em> in <em>cities<\/em> in case the name is too long, producing an undefined behavior<\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\"><\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved How to print cities correctly using recursive? [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] very probably a reasonable definition of cities (which was much better named City, no reason so have it plural) is typedef struct cities { char name[64]; struct cities * e; struct cities * n; struct cities * s; struct cities * w; } cities; and your problem is to write all the links without &#8230; <a title=\"[Solved] How to print cities correctly using recursive? [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/\" aria-label=\"More on [Solved] How to print cities correctly using recursive? [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[324,1826],"class_list":["post-6583","post","type-post","status-publish","format-standard","hentry","category-solved","tag-c","tag-recursive-datastructures"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] How to print cities correctly using recursive? [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] How to print cities correctly using recursive? [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] very probably a reasonable definition of cities (which was much better named City, no reason so have it plural) is typedef struct cities { char name[64]; struct cities * e; struct cities * n; struct cities * s; struct cities * w; } cities; and your problem is to write all the links without ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-03T21:59:34+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] How to print cities correctly using recursive? [closed]\",\"datePublished\":\"2022-09-03T21:59:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/\"},\"wordCount\":330,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"c++\",\"recursive-datastructures\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/\",\"name\":\"[Solved] How to print cities correctly using recursive? [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-09-03T21:59:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] How to print cities correctly using recursive? [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] How to print cities correctly using recursive? [closed] - JassWeb","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:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] How to print cities correctly using recursive? [closed] - JassWeb","og_description":"[ad_1] very probably a reasonable definition of cities (which was much better named City, no reason so have it plural) is typedef struct cities { char name[64]; struct cities * e; struct cities * n; struct cities * s; struct cities * w; } cities; and your problem is to write all the links without ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/","og_site_name":"JassWeb","article_published_time":"2022-09-03T21:59:34+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] How to print cities correctly using recursive? [closed]","datePublished":"2022-09-03T21:59:34+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/"},"wordCount":330,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["c++","recursive-datastructures"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/","name":"[Solved] How to print cities correctly using recursive? [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-09-03T21:59:34+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-print-cities-correctly-using-recursive-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] How to print cities correctly using recursive? [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/6583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=6583"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/6583\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=6583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=6583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=6583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}