Program Console Vignaankosh.com
Execution Panel
Console is empty.
Error Handling with Switch is an interactive C dry run visualizer from the Switch programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.
This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.
#include <stdio.h>
int main() {
int statusCode;
printf("Enter HTTP status code: ");
scanf("%d", &statusCode);
switch(statusCode) {
case 200:
printf(" OK - Request successful\n");
break;
case 201:
printf(" Created - Resource created\n");
break;
case 400:
printf(" Bad Request - Invalid syntax\n");
break;
case 401:
printf(" Unauthorized - Authentication required\n");
break;
case 403:
printf(" Forbidden - Access denied\n");
break;
case 404:
printf(" Not Found - Resource doesn't exist\n");
break;
case 500:
printf(" Internal Server Error\n");
break;
default:
if(statusCode >= 100 && statusCode < 200)
printf("Informational response\n");
else if(statusCode >= 300 && statusCode < 400)
printf("Redirection message\n");
else
printf("Unknown status code\n");
}
return 0;
}