{"id":3164,"date":"2021-06-22T13:29:00","date_gmt":"2021-06-22T07:59:00","guid":{"rendered":"https:\/\/manorinfinity.com\/blog\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/"},"modified":"2021-06-22T13:29:00","modified_gmt":"2021-06-22T07:59:00","slug":"c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs","status":"publish","type":"post","link":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/","title":{"rendered":"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS"},"content":{"rendered":"<p><span style=\"font-size: large;\">&nbsp;<span style=\"font-family: courier;\">&nbsp; So, we have to write a C program that creates and traverses the circular doubly linked list in both direction i.e. in forward and backward direction. Take care while handling the pointers in the program, because we are going to handle lots of pointers.<\/span><\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\">Also read:&nbsp;<a href=\"https:\/\/www.bitsofcs.xyz\/2021\/06\/doubly-circular-linked-list.html\" target=\"_blank\" rel=\"noopener noreferrer\">Circular Doubly Linked List<\/a><\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\"><br \/><\/span><\/p>\n<h2><span style=\"font-family: courier; font-size: large;\">Declaring a Circular Linked List:<\/span><\/h2>\n<p><span style=\"font-family: courier; font-size: large;\">So, we know that we can declare elements (nodes) of circular doubly linked list using&nbsp;<a href=\"https:\/\/www.bitsofcs.xyz\/2021\/06\/self-referential-structure.html\" target=\"_blank\" rel=\"noopener noreferrer\">self referential structure<\/a>.<\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\"><b>Example of self referential structure:<\/b><\/span><\/p>\n<p><span style=\"font-size: large;\"><\/span><\/p>\n<p><span style=\"font-size: large;\"><br \/><\/span><\/p>\n<h2><span style=\"font-family: courier; font-size: large;\">Function Definition:<\/span><\/h2>\n<p><span style=\"font-family: courier; font-size: large;\">In our program, we have three functions i.e. first function to create the circular doubly linked list, second to traverse the circular doubly linked list in the forward direction and third one is to traverse the circular doubly linked list in the backward direction.<\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\"><br \/><\/span><\/p>\n<\/p>\n<ol>\n<li><span style=\"font-family: courier; font-size: large;\"><b>void create_list(int);<\/b>&nbsp;This function helps to create the circular doubly linked list. create_list() function takes an integer as an argument that creates the number of nodes in the circular doubly linked list and returns nothing.<\/span><\/li>\n<li><span style=\"font-family: courier; font-size: large;\"><b>void trav_f(void);<\/b>&nbsp;This function helps to traverse the circular doubly linked list in forward direction. trav_f() function takes nothing as input and returns nothing.<\/span><\/li>\n<li><span style=\"font-family: courier; font-size: large;\"><b>void trav_b(void);<\/b>&nbsp;This function helps to traverse the circular doubly linked list in backward direction. trav_b() function takes nothing as input and returns nothing.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-family: courier; font-size: large;\"><b>C program for Create and Traverse Circular Doubly Linked List:<\/b><\/span><\/p>\n<p><span style=\"font-size: large;\"><\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\"><br \/><\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\"><b>Output-<\/b><\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-family: courier; font-size: large;\"><\/span><\/p>\n<div style=\"clear: both; text-align: center;\"><span style=\"font-family: courier; font-size: large;\"><img data-recalc-dims=\"1\" height=\"102\" width=\"300\" decoding=\"async\" alt=\"\" data-original-height=\"155\" data-original-width=\"456\" src=\"https:\/\/i0.wp.com\/explore.techenutia.com\/wp-content\/uploads\/2021\/06\/image-300x102.png?resize=300%2C102&#038;ssl=1\" \/><\/span><\/div>\n<\/p>\n<p><span style=\"font-family: courier; font-size: large;\">This is how our circular doubly linked list looked like:<\/span><\/p>\n<p style=\"text-align: center;\">\n<div style=\"clear: both; text-align: center;\"><span style=\"font-size: large;\"><img data-recalc-dims=\"1\" height=\"93\" width=\"300\" decoding=\"async\" border=\"0\" data-original-height=\"259\" data-original-width=\"837\" src=\"https:\/\/i0.wp.com\/explore.techenutia.com\/wp-content\/uploads\/2021\/06\/cd-300x93.png?resize=300%2C93&#038;ssl=1\" \/><\/span><\/div>\n<\/p>\n<p><span style=\"font-family: courier; font-size: large;\">If you find any problem related to this article, please comment below or contact me&nbsp;<a href=\"https:\/\/www.bitsofcs.xyz\/p\/contact-me.html\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp; So, we have to write a C program that creates and traverses the circular doubly linked list in both direction i.e. in forward and backward direction. Take care while handling the pointers in the program, because we are going to handle lots of pointers. Also read:&nbsp;Circular Doubly Linked List&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/\">Read the post<span class=\"screen-reader-text\">C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":3182,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3164","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-infinity-fitness","excerpt","zoom","full-without-featured","even","excerpt-0"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.12 (Yoast SEO v26.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS | ManOrInfinity<\/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:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS\" \/>\n<meta property=\"og:description\" content=\"&nbsp;&nbsp; So, we have to write a C program that creates and traverses the circular doubly linked list in both direction i.e. in forward and backward direction. Take care while handling the pointers in the program, because we are going to handle lots of pointers. Also read:&nbsp;Circular Doubly Linked List&#8230;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/\" \/>\n<meta property=\"og:site_name\" content=\"ManOrInfinity\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-22T07:59:00+00:00\" \/>\n<meta name=\"author\" content=\"manorinfinity\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@manorinfinity\" \/>\n<meta name=\"twitter:site\" content=\"@manorinfinity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"manorinfinity\" \/>\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:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/\"},\"author\":{\"name\":\"manorinfinity\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901\"},\"headline\":\"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS\",\"datePublished\":\"2021-06-22T07:59:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/\"},\"wordCount\":274,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901\"},\"image\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#primaryimage\"},\"thumbnailUrl\":\"\",\"articleSection\":[\"Infinity Fitness\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/\",\"url\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/\",\"name\":\"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS | ManOrInfinity\",\"isPartOf\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2021-06-22T07:59:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/manorinfinity.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/#website\",\"url\":\"https:\/\/manorinfinity.com\/blog\/\",\"name\":\"ManOrInfinity\",\"description\":\"Thrive towards greatness\",\"publisher\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/manorinfinity.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901\",\"name\":\"manorinfinity\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/manorinfinity.com\/wp-content\/uploads\/2023\/06\/moi-logo.png\",\"contentUrl\":\"http:\/\/manorinfinity.com\/wp-content\/uploads\/2023\/06\/moi-logo.png\",\"width\":282,\"height\":260,\"caption\":\"manorinfinity\"},\"logo\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Complex Problem Solver, Outloud Thinker, An Outstanding Writer, and a very curious human being\",\"sameAs\":[\"http:\/\/manorinfinity.com\"],\"url\":\"https:\/\/manorinfinity.com\/blog\/author\/manorinfinity\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS | ManOrInfinity","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:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/","og_locale":"en_US","og_type":"article","og_title":"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS","og_description":"&nbsp;&nbsp; So, we have to write a C program that creates and traverses the circular doubly linked list in both direction i.e. in forward and backward direction. Take care while handling the pointers in the program, because we are going to handle lots of pointers. Also read:&nbsp;Circular Doubly Linked List&#8230;","og_url":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/","og_site_name":"ManOrInfinity","article_published_time":"2021-06-22T07:59:00+00:00","author":"manorinfinity","twitter_card":"summary_large_image","twitter_creator":"@manorinfinity","twitter_site":"@manorinfinity","twitter_misc":{"Written by":"manorinfinity","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#article","isPartOf":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/"},"author":{"name":"manorinfinity","@id":"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901"},"headline":"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS","datePublished":"2021-06-22T07:59:00+00:00","mainEntityOfPage":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/"},"wordCount":274,"commentCount":0,"publisher":{"@id":"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901"},"image":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#primaryimage"},"thumbnailUrl":"","articleSection":["Infinity Fitness"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/","url":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/","name":"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS | ManOrInfinity","isPartOf":{"@id":"https:\/\/manorinfinity.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#primaryimage"},"image":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#primaryimage"},"thumbnailUrl":"","datePublished":"2021-06-22T07:59:00+00:00","breadcrumb":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/22\/c-program-to-create-and-traverse-circular-doubly-linked-list-bitsofcs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/manorinfinity.com\/blog\/"},{"@type":"ListItem","position":2,"name":"C Program to Create and Traverse Circular Doubly Linked List | BitsOfCS"}]},{"@type":"WebSite","@id":"https:\/\/manorinfinity.com\/blog\/#website","url":"https:\/\/manorinfinity.com\/blog\/","name":"ManOrInfinity","description":"Thrive towards greatness","publisher":{"@id":"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/manorinfinity.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901","name":"manorinfinity","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/image\/","url":"http:\/\/manorinfinity.com\/wp-content\/uploads\/2023\/06\/moi-logo.png","contentUrl":"http:\/\/manorinfinity.com\/wp-content\/uploads\/2023\/06\/moi-logo.png","width":282,"height":260,"caption":"manorinfinity"},"logo":{"@id":"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/image\/"},"description":"Complex Problem Solver, Outloud Thinker, An Outstanding Writer, and a very curious human being","sameAs":["http:\/\/manorinfinity.com"],"url":"https:\/\/manorinfinity.com\/blog\/author\/manorinfinity\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/posts\/3164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/comments?post=3164"}],"version-history":[{"count":0,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/posts\/3164\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/media?parent=3164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/categories?post=3164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/tags?post=3164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}