K

@kevshouse

my_n_queen.c

C
1 year ago
#include <stdio.h> #include <unistd.h> /* # Iterate over each diagonal slice. for k in range(2 * n - 1): # Calculate the number of cells in the current diagonal slice. count = min(k + 1, n, 2 * n - k - 1) # Store the cell count in the dictionary. diagonal_counts[k] = count

ft_fibonacci.c

C
1 year ago
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_fibnacci.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: keanders <marvin@42.fr> +#+ +:+ +#+ */ /*

int_min-int_max.c

C
1 year ago
#include <stdio.h> #include <limits.h> int main() { printf("INT_MIN %d\n", INT_MIN); printf("INT_MAX %d\n", INT_MAX); return 0; }

ft_interative_factorial.c

C
1 year ago
#include <stdio.h> int ft_iterative_factorial(int nb) { int i; int ans; i = 1; ans = 1; while(i <= nb)

V0-ft_putnbr_base.c

C
1 year ago
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putnbr_base.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: keanders <marvin@42.fr> +#+ +:+ +#+ */ /*

ft_putnbr_base.c

C
1 year ago
/* This code tests for legal number bases, used in the ft_putnbr_base program. */ #include <unistd.h> int legal_base_check(char *base) { int i; int j; i = 0;

llegal_base_check.c

C
1 year ago
/* This code tests for legal number bases, used in the ft_putnbr_base program. */ #include <unistd.h> int legal_base_check(char *base) { int i; int j; i = 0;

llegal_base_check.c

C
1 year ago
/* This code tests for legal number bases, used in the ft_putnbr_base program. */ int legal_base_check(char *base) { int i; int j; i = 0; // base zero rejection

base_conv.c

C
1 year ago
#include <unistd.h> void base_conv(int nbr, int base) { if (nbr == 0) { return; // base case: 0 in any base is just "0" } base_conv(nbr / base, base); // recursive call for the quotient

char_exist.c

C
1 year ago
#include <stdio.h> char my_str[] = "hello42"; int char_exist(char c, char *str) { int i; i = 0; while (str[i] != '\0')

ft_put_base.c

C
1 year ago
#include <stdio.h> #include <unistd.h> void ft_putchar(char c) { write(1, &c, 1); } void ft_putnbr(int nb) {

ft_strncat.c

C
1 year ago
#include <stdio.h> int ft_strlen(char *str) { int i; i = 0; while(str[i] != '\0') { i++;

ft_strcmp.c

C
1 year ago
#include <stdio.h> int ft_strcmp(char *s1, char *s2) { int i = 0; while (s1[i] != '\0' && s2[i] != '\0' && s1[i] == s2[i]) { i++; } return s1[i] - s2[i];

testing_strcmp.c

C
1 year ago
#include <string.h> #include <stdio.h> int main() { char str1[] = "hello"; char str2[] = "helloa";

ft_strlcpy.c

C
1 year ago
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size) { // Bounds Check, check that dest >= src. // Return the size of src. unsigned int i; unsigned int src_size; i = 0; src_size = 0;

ft_putstr_non_printable.c

C
1 year ago
#include <stdio.h> #include <unistd.h> void ft_putstr_non_printable(char *str) { int i = 0; while (str[i]!= '\0')

broken_ft_strcapitalize

C
1 year ago
void ft_strlowcase(char *str) { int i; i = 0; while (str[i] != '\0') { if ((str[i] >= 'A' && str[i] <= 'Z')) { str[i] += 32;

ft_strcapitalize.c

C
1 year ago
/* int ft_is_alpha(char *ch) { if (*ch >= 'a' && *ch <= 'z') return (1); return (0); } int ft_str_is_numeric(char *ch)

Bits_bitwise-or_and_count.c

C
1 year ago
#include <stdio.h> /* I added a new function printBinary that takes an unsigned int as an argument. The printBinary function uses a loop to iterate over the 8 bits of the unsigned int (from most significant bit to least significant bit). Inside the loop, I use the bitwise right shift operator >> to shift the bits of num to the right by i positions. This effectively divides num by 2^i. I then use the bitwise AND operator & to mask the result with 1, which gives me the value of

pointed_play.c

C
1 year ago
#include <stdio.h> int my_num; char my_char; // Numeric Pointer int *my_numeric_pointer; // Char Pointer int *my_char_pointer; // Int Array Pointer int numbers[5];