Skip to content

Instantly share code, notes, and snippets.

@Juskr04
Juskr04 / .c
Created September 1, 2025 11:19
Basic arena allocator(incomplete)
#include <sys/mman.h>
#include <stdint.h>
#include <stddef.h>
#include <sanitizer/asan_interface.h>
#include "./stdint.h"
typedef struct
{
u8 *arena_start_pos;
size_t size;//total bytes allocated for the arena
@Juskr04
Juskr04 / functions.c
Last active July 17, 2025 11:20
cs50 pset2 substitution problem
int calculate_key_size(char argv[]); // returns size of key
int is_alphabet_arr(char argv[]); // checks whether all elements of an array are alphabets
int is_alphabet_char(char a); // checks whether a character is an alphabet
int repeat_letter_check(char argv[]); // checks whether a letter repeats in an array
int alphabet_case_check(char a); // returns 0 for lowercase and 1 for uppercase
int calculate_key_size(char argv[]){
int i = 0;
int key_size = 0;
while(argv[i] != '\0'){
@Juskr04
Juskr04 / substitution.c
Last active July 17, 2025 11:33
cs50 pset2 substitution problem
#include<stdio.h>
#include"functions.c"
int check_key_validity(char argv[]); // checks whether the key given by the user is valid or not according to constraints
int main(int argc, char* argv[]){
if(argc != 2){
printf("Usage : ./program_name key");
return 1;
}
@Juskr04
Juskr04 / substitution.c
Last active July 17, 2025 11:20
cs50 pset2 substitution problem
#include<stdio.h>
int calculate_key_size(char argv[]); // returns size of key
int is_alphabet_arr(char argv[]); // checks whether all elements of an array are alphabets
int is_alphabet_char(char a); // checks whether a character is an alphabet
int repeat_letter_check(char argv[]); // checks whether a letter repeats in an array
int check_key_validity(char argv[]); // checks whether the key given by the user is valid or not according to constraints
int case_check(char a); // returns 0 for lowercase and 1 for uppercase