Error Codes

Easy Enumerations & Typedef
Solve in Playground →

Problem Statement

Write a C program using an enum for error codes (SUCCESS=0, ERR_MEM=1, ERR_FILE=2, ERR_PARAM=3) and print matching text descriptions.

Input Format

An integer error code (0 to 3).

Output Format

Print the descriptive error message.

Constraints

0 <= Code <= 3

Sample Input

1

Sample Output

Memory Allocation Error

Explanation

Code 1 maps to 'Memory Allocation Error'.

Starter Code

#include <stdio.h>

enum ErrorCode { SUCCESS = 0, ERR_MEM, ERR_FILE, ERR_PARAM };

int main() {
    int code;
    if (scanf("%d", &code) == 1) {
        // Write your code here
    }
    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