{"id":3165,"date":"2021-06-19T16:12:00","date_gmt":"2021-06-19T10:42:00","guid":{"rendered":"https:\/\/manorinfinity.com\/blog\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/"},"modified":"2021-06-19T16:12:00","modified_gmt":"2021-06-19T10:42:00","slug":"c-program-to-create-and-traverse-circular-linked-list-bitsofcs","status":"publish","type":"post","link":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/","title":{"rendered":"C Program to Create and Traverse Circular Linked List | BitsOfCS"},"content":{"rendered":"<p><span style=\"font-family: courier; font-size: large;\">&nbsp;So, we have to write a C program that creates and traverses the circular linked list. Take care while handling the pointers in the program, because we are going to manipulate lots of pointers.<\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\">Also read: <a href=\"https:\/\/www.bitsofcs.xyz\/2021\/06\/circular-linked-list.html\" target=\"_blank\" rel=\"noopener noreferrer\">Circular Linked List<\/a><\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\"><br \/><\/span><\/p>\n<h2 style=\"text-align: left;\"><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 linked list using <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-family: courier; font-size: large;\"><br \/><\/span><\/p>\n<h2 style=\"text-align: left;\"><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 two functions i.e. first function to create the circular linked list and second to traverse the circular linked list.<\/span><\/p>\n<\/p>\n<ol style=\"text-align: left;\">\n<li><span style=\"font-family: courier; font-size: large;\"><b>void create_list(int);<\/b> This function helps to create the circular linked list. create_list() function takes an integer as an argument that creates the number of nodes in the circular linked list and returns nothing.<\/span><\/li>\n<li><span style=\"font-family: courier; font-size: large;\"><b>void traverse(void);<\/b> This function helps to traverse the circular linked list. traverse() function takes nothing as input and returns nothing.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-family: courier; font-size: large;\"><br \/><\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\"><b>C program for Create and Traverse Circular Linked List:<\/b><\/span><\/p>\n<p><span style=\"font-size: large;\"><\/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;\">\n<div style=\"clear: both; text-align: center;\"><span style=\"font-family: courier; font-size: large;\"><span><span style=\"font-family: Arial; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;\"><\/span><\/span><span><span style=\"font-family: Arial; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;\"><\/span><\/span><span><span style=\"font-family: Arial; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;\"><span style=\"border: none; display: inline-block; height: 118px; overflow: hidden; width: 403px;\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/dO7uvBKwiJU4wSu44oVd0ntRvbvExkQWev0fDdjXFJsox2L6kWvnMc7vR5EIHJDt--t1jDxfzchIZ9l5FAr27MZXirkkhOpLX8OGYJY7YDzDUUMJQRdqsmVcL18PcWnY8wdYec-F=s16000\" style=\"margin-left: 0px; margin-top: 0px;\" \/><\/span><\/span><\/span><\/span><\/div>\n<\/div>\n<p><span style=\"font-family: courier; font-size: large;\"><br \/><\/span><\/p>\n<p><span style=\"font-family: courier; font-size: large;\">This is how our circular 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=\"122\" width=\"300\" decoding=\"async\" border=\"0\" data-original-height=\"219\" data-original-width=\"537\" src=\"https:\/\/i0.wp.com\/explore.techenutia.com\/wp-content\/uploads\/2021\/06\/asd-300x122.png?resize=300%2C122&#038;ssl=1\" \/><\/span><\/div>\n<p><span style=\"font-family: courier; font-size: large;\"><br \/><\/span><\/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 <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;So, we have to write a C program that creates and traverses the circular linked list. Take care while handling the pointers in the program, because we are going to manipulate lots of pointers. Also read: Circular Linked List Declaring a Circular Linked List: So, we know that we can&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/\">Read the post<span class=\"screen-reader-text\">C Program to Create and Traverse Circular Linked List | BitsOfCS<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":3185,"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-3165","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 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\/19\/c-program-to-create-and-traverse-circular-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 Linked List | BitsOfCS\" \/>\n<meta property=\"og:description\" content=\"&nbsp;So, we have to write a C program that creates and traverses the circular linked list. Take care while handling the pointers in the program, because we are going to manipulate lots of pointers. Also read: Circular Linked List Declaring a Circular Linked List: So, we know that we can&#8230;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/\" \/>\n<meta property=\"og:site_name\" content=\"ManOrInfinity\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-19T10:42: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\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/\"},\"author\":{\"name\":\"manorinfinity\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901\"},\"headline\":\"C Program to Create and Traverse Circular Linked List | BitsOfCS\",\"datePublished\":\"2021-06-19T10:42:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/\"},\"wordCount\":196,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901\"},\"image\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#primaryimage\"},\"thumbnailUrl\":\"\",\"articleSection\":[\"Infinity Fitness\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/\",\"url\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/\",\"name\":\"C Program to Create and Traverse Circular Linked List | BitsOfCS | ManOrInfinity\",\"isPartOf\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2021-06-19T10:42:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-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 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 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\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/","og_locale":"en_US","og_type":"article","og_title":"C Program to Create and Traverse Circular Linked List | BitsOfCS","og_description":"&nbsp;So, we have to write a C program that creates and traverses the circular linked list. Take care while handling the pointers in the program, because we are going to manipulate lots of pointers. Also read: Circular Linked List Declaring a Circular Linked List: So, we know that we can&#8230;","og_url":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/","og_site_name":"ManOrInfinity","article_published_time":"2021-06-19T10:42: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\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#article","isPartOf":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/"},"author":{"name":"manorinfinity","@id":"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901"},"headline":"C Program to Create and Traverse Circular Linked List | BitsOfCS","datePublished":"2021-06-19T10:42:00+00:00","mainEntityOfPage":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/"},"wordCount":196,"commentCount":0,"publisher":{"@id":"https:\/\/manorinfinity.com\/blog\/#\/schema\/person\/1172b1895b5eb7e49cc8640e49255901"},"image":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#primaryimage"},"thumbnailUrl":"","articleSection":["Infinity Fitness"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/","url":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/","name":"C Program to Create and Traverse Circular Linked List | BitsOfCS | ManOrInfinity","isPartOf":{"@id":"https:\/\/manorinfinity.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#primaryimage"},"image":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#primaryimage"},"thumbnailUrl":"","datePublished":"2021-06-19T10:42:00+00:00","breadcrumb":{"@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-linked-list-bitsofcs\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/manorinfinity.com\/blog\/2021\/06\/19\/c-program-to-create-and-traverse-circular-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 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\/3165","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=3165"}],"version-history":[{"count":0,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/posts\/3165\/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=3165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/categories?post=3165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/manorinfinity.com\/blog\/wp-json\/wp\/v2\/tags?post=3165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}