Skip to content

Instantly share code, notes, and snippets.

View priyanshugaurav's full-sized avatar

Priyanshu Gaurav priyanshugaurav

View GitHub Profile
@priyanshugaurav
priyanshugaurav / my_printf.c
Created May 11, 2025 04:47
Our own printf() in C Using putchar() 
#include <stdarg.h> // for va_list
#include <stdio.h> // for putchar
// Print a string
void print_string(const char *str) {
while (*str) {
putchar(*str);
str++;
}
}
@priyanshugaurav
priyanshugaurav / jsonParser.c
Created May 9, 2025 13:04
A simple JSON parser in C that parses JSON files and allows accessing nested values using dot notation.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
// Type of JSON values
typedef enum {
TYPE_STRING,
TYPE_NUMBER,
TYPE_BOOL,