Create Circular Queue

Easy Circular Queue
Solve in Playground →

Problem Statement

Write a C program to initialize a circular queue with a given capacity, setting front, rear, and size pointers.

Input Format

An integer capacity value.

Output Format

Print the initialized capacity and initial front/rear values.

Constraints

1 <= capacity <= 100

Sample Input

5

Sample Output

Capacity: 5, Front: 0, Rear: -1

Explanation

Allocate a circular queue structure with capacity, setting front = 0, rear = -1, and size = 0.

Starter Code

#include <stdio.h>
#include <stdlib.h>

struct CircularQueue {
    int *arr;
    int capacity;
    int front;
    int rear;
    int size;
};

int main() {
    int cap;
    if (scanf("%d", &cap) == 1) {
        // Write your code here to create circular queue
    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used