├── 0x15-file_io ├── hello ├── README.md ├── a ├── b ├── c ├── cp ├── main.h ├── 1-main.c ├── 2-main.c └── 0-main.c ├── 0x03-debugging ├── README.md ├── main.h ├── 0-main.c ├── 1-main.c └── 2-largest_number.c ├── 0x0D-preprocessor ├── README.md ├── 4-sum.h ├── 1-pi.h ├── 0-object_like_macro.h ├── 3-function_like_macro.h └── 2-main.c ├── 0x17-doubly_linked_lists ├── 102-result ├── 100-password ├── README.md ├── c ├── d ├── e ├── h ├── i ├── crackme4.pyc ├── 1-dlistint_len.c ├── 0-print_dlistint.c ├── 6-sum_dlistint.c └── 4-free_dlistint.c ├── 0x0C-more_malloc_free ├── README.md ├── a ├── 101-mul ├── 2-calloc ├── 100-realloc ├── 3-array_range ├── 1-string_nconcat ├── main.h ├── _putchar.c ├── 0-malloc_checked.c ├── 1-main.c ├── 2-calloc.c └── 3-array_range.c ├── 0x12-singly_linked_lists ├── .history │ ├── 4:_20191031192705 │ ├── 4:_20191031192707 │ ├── 0-main_20191031141309.c │ ├── 1-main_20191031153653.c │ ├── 2-main_20191031154620.c │ ├── 3-main_20191031180435.c │ ├── 4-main_20191031190119.c │ ├── README_20191031141209.md │ ├── lists_20191031141537.h │ ├── 0-print_list_20191031141508.c │ ├── 1-list_len_20191031153205.c │ ├── 100-first_20191031191452.c │ ├── 100-main_20191031190849.c │ ├── 2-add_node_20191031154711.c │ ├── 4-free_list_20191031190132.c │ ├── _putchar_20191031151111.c │ ├── 3-add_node_end_20191031180517.c │ ├── 101-hello_holberton_20191031190514.asm │ ├── README_20191031141240.md │ ├── 0-print_list_20191031142101.c │ ├── 4-free_list_20191031195027.c │ ├── 4-free_list_20191031195455.c │ ├── 0-print_list_20191031142227.c │ ├── 100-first_20191031191727.c │ ├── 1-list_len_20191031153734.c │ ├── 100-first_20191031191816.c │ ├── 100-first_20191031191954.c │ ├── 100-first_20191031192004.c │ ├── 100-first_20191031191934.c │ ├── 2-add_node_20191031154838.c │ ├── 2-add_node_20191031154940.c │ ├── 101-hello_holberton_20191031190532.asm │ ├── 0-print_list_20191031144250.c │ ├── 0-print_list_20191031144435.c │ ├── 0-print_list_20191031144438.c │ ├── 0-print_list_20191031144440.c │ ├── 1-list_len_20191031154145.c │ ├── 1-list_len_20191031154346.c │ ├── 100-main_20191031190909.c │ ├── 100-main_20191031190910.c │ ├── 100-main_20191031190924.c │ ├── 100-main_20191031190925.c │ ├── 100-main_20191031190926.c │ ├── 100-main_20191031190927.c │ ├── 4-free_list_20191031200304.c │ ├── _putchar_20191031151150.c │ ├── 0-print_list_20191031144607.c │ ├── 0-print_list_20191031144718.c │ ├── 0-print_list_20191031144805.c │ ├── 0-print_list_20191031143101.c │ ├── 100-first_20191031192102.c │ ├── 0-print_list_20191031143025.c │ ├── 0-print_list_20191031143136.c │ ├── 0-print_list_20191031143232.c │ ├── 0-print_list_20191031143313.c │ ├── 4-free_list_20191031195507.c │ ├── 4-free_list_20191031195643.c │ ├── 0-print_list_20191031144914.c │ ├── 100-first_20191031192315.c │ ├── 4-free_list_20191031195405.c │ ├── 4-free_list_20191031200001.c │ ├── 4-free_list_20191031200121.c │ ├── 4-free_list_20191031200159.c │ ├── 0-print_list_20191031145125.c │ ├── 0-print_list_20191031145905.c │ ├── 0-print_list_20191031145916.c │ ├── 0-print_list_20191031150151.c │ ├── 0-print_list_20191031150219.c │ ├── 0-print_list_20191031150222.c │ ├── 0-print_list_20191031150323.c │ ├── 0-print_list_20191031145544.c │ ├── 0-print_list_20191031145559.c │ ├── 0-print_list_20191031145620.c │ ├── 0-print_list_20191031145649.c │ ├── 0-print_list_20191031145711.c │ ├── 0-print_list_20191031145834.c │ ├── 0-print_list_20191031150738.c │ ├── 0-print_list_20191031151428.c │ ├── 0-print_list_20191031151521.c │ ├── 0-print_list_20191031151815.c │ ├── 0-print_list_20191031151956.c │ ├── 0-print_list_20191031152805.c │ ├── 0-print_list_20191105123438.c │ ├── 0-print_list_20191105123104.c │ ├── 0-print_list_20191031152410.c │ ├── 0-print_list_20191105122844.c │ ├── 0-print_list_20191031152257.c │ └── 2-add_node_20191031165115.c ├── README.md ├── 0-print ├── 101-hello_holberton.o ├── 101-hello_holberton.asm ├── 1-list_len.c ├── 100-main.c ├── 4-free_list.c ├── _putchar.c ├── 100-first.c ├── 0-print_list.c └── 4-main.c ├── 0x1A-hash_tables ├── README.md ├── a ├── b ├── d ├── .3-hash_table_set.c.swp ├── 0-main.c ├── 3-main.c ├── 1-djb2.c ├── 2-key_index.c └── 1-main.c ├── 0x14-bit_manipulation ├── 101-password ├── README.md ├── a ├── b ├── _putchar.c ├── 100-get_endianness.c ├── 1-print_binary.c ├── 2-get_bit.c ├── 5-flip_bits.c ├── 3-set_bit.c ├── 1-main.c ├── 4-clear_bit.c ├── main.h └── 0-main.c ├── 0x00-hello_world ├── 1-compiler ├── 2-assembler ├── 3-name ├── README.md ├── 0-preprocessor ├── 100-intel ├── a.out ├── c.exe ├── cisfun ├── main.o ├── quote ├── size32 ├── size64 ├── cisfun.exe ├── .100-intel.swp ├── .6-sizes.c.swp ├── main.c ├── 4-puts.c ├── 5-printf.c ├── 101-quote.c └── 6-size.c ├── 0x07-pointers_arrays_strings ├── 101-crackme_password ├── 0x07-pointers_arrays_strings │ ├── 101-crackme_password │ ├── README.md │ ├── crackme2 │ ├── 100-set_string.c │ ├── _putchar.c │ ├── 5-main.c │ ├── 4-main.c │ ├── 2-main.c │ ├── 100-main.c │ ├── 1-memcpy.c │ ├── 3-main.c │ ├── main.h │ └── 7-print_chessboard.c ├── README.md ├── crackme2 ├── 100-set_string.c ├── _putchar.c ├── 5-main.c ├── 4-main.c ├── 2-main.c ├── 100-main.c ├── 1-memcpy.c ├── 3-main.c ├── main.h └── 7-print_chessboard.c ├── 0x08-recursion ├── README.md ├── 4-pow ├── 5-sqrt ├── 6-prime ├── 101-wildcmp ├── 3-factorial ├── 100-palindrome ├── 0-puts_recursion ├── 2-strlen_recursion ├── .0-puts_recursion.c.swp ├── 1-print_rev_recursion ├── .1-print_rev_recursion.c.swp ├── 0-main.c ├── 1-main.c ├── _putchar.c ├── 2-main.c ├── 3-factorial.c ├── 0-puts_recursion.c ├── 1-print_rev_recursion.c ├── 2-strlen_recursion.c ├── main.h ├── 4-pow_recursion.c ├── 3-main.c ├── 100-main.c ├── 5-main.c └── 4-main.c ├── 0x10-variadic_functions ├── README.md ├── a ├── b ├── c ├── .1-print_numbers.c.swp ├── 3-main.c ├── 2-main.c ├── 1-main.c ├── 0-main.c ├── variadic_functions.h └── 0-sum_them_all.c ├── README.md ├── 0x09-static_libraries ├── README.md ├── create_static_lib.sh ├── main.o ├── quote ├── 3-puts.o ├── 6-abs.o ├── liball.a ├── libmy.a ├── 0-isupper.o ├── 0-memset.o ├── 0-strcat.o ├── 1-isdigit.o ├── 1-memcpy.o ├── 1-strncat.o ├── 100-atoi.o ├── 2-strchr.o ├── 2-strlen.o ├── 2-strncpy.o ├── 3-islower.o ├── 3-strcmp.o ├── 3-strspn.o ├── 4-isalpha.o ├── 4-strpbrk.o ├── 5-strstr.o ├── 9-strcpy.o ├── _putchar.o ├── main.c ├── 2-strlen.c ├── 1-isdigit.c ├── 6-abs.c ├── _putchar.c ├── 3-puts.c ├── 9-strcpy.c ├── 3-strcmp.c ├── 0-strcat.c ├── 2-strncpy.c ├── 1-strncat.c ├── 1-memcpy.c ├── 100-atoi.c ├── 0-isupper.c └── 3-islower.c ├── 0x0A-argc_argv ├── README.md ├── add ├── mul ├── args ├── nargs ├── change ├── .4-add.c.swp ├── mynewnameis ├── 0-whatsmyname.c ├── 1-args.c ├── 2-args.c └── 3-mul.c ├── 0x05-pointers_arrays_strings ├── README.md ├── 0-98 ├── 1-swap ├── 3-puts ├── 100-atoi ├── 2-strlen ├── 6-puts2 ├── 9-strcpy ├── 101-keygen ├── 4-print_rev ├── 7-puts_half ├── 5-rev_string ├── 8-print_array ├── .5-rev_string.c.swp ├── .7-puts_half.c.swp ├── .8-print_array.c.swp ├── 0-reset_to_98.c ├── 2-strlen.c ├── 6-main.c ├── 7-main.c ├── 1-swap.c ├── 3-main.c ├── 4-main.c ├── _putchar.c ├── 0-main.c ├── 3-puts.c ├── 5-main.c ├── 9-strcpy.c ├── 2-main.c ├── 4-print_rev.c ├── 6-puts2.c ├── 8-main.c ├── main.h ├── 1-main.c ├── 9-main.c ├── 7-puts_half.c ├── 8-print_array.c ├── 5-rev_string.c └── 100-atoi.c ├── 0x0B-malloc_free ├── README.md ├── a ├── c ├── f ├── g ├── s ├── args ├── strtow ├── .0-create_array.c.swp ├── _putchar.c ├── 4-free_grid.c ├── main.h ├── 100-main.c ├── 2-main.c ├── 1-main.c ├── 1-strdup.c └── 0-create_array.c ├── 0x0F-function_pointers ├── README.md ├── a ├── b ├── c ├── calc ├── main ├── .3-get_op_func.c.swp ├── _putchar.c ├── 0-print_name.c ├── function_pointers.h ├── 3-calc.h ├── 1-array_iterator.c └── 3-get_op_func.c ├── 0x1C-makefiles ├── 0-Makefile ├── 1-Makefile ├── 2-Makefile ├── m.h ├── main.c ├── 3-Makefile ├── 4-Makefile ├── 100-Makefile └── tests │ └── 5-main.py ├── 0x06-pointers_arrays_strings ├── README.md ├── 0-strcat ├── 1-strncat ├── 3-strcmp ├── .2-main.c.swp ├── .1-strncat.c.swp ├── .3-strcmp.c.swo ├── .3-strcmp.c.swp ├── 3-strcmp.c ├── 0-strcat.c ├── 2-strncpy.c ├── 4-rev_array.c ├── 3-main.c ├── 1-strncat.c ├── 5-string_toupper.c ├── 101-print_number.c ├── 0-main.c ├── main.h ├── 102-magic.c ├── 7-leet.c ├── 1-main.c └── 6-cap_string.c ├── 0x0E-structures_typedef ├── README.md ├── a ├── b ├── c ├── d ├── e ├── f ├── .4-new_dog.c.swp ├── 5-free_dog.c ├── _putchar.c ├── 2-main.c ├── 1-main.c ├── 4-main.c ├── 5-main.c ├── 3-main.c ├── 0-main.c ├── 1-init_dog.c ├── 2-print_dog.c └── dog.h ├── 0x02-functions_nested_loops ├── README.md ├── 6-abs ├── 8-24 ├── 10-add ├── 5-sign ├── 0-putchar ├── 1-alphabet ├── 3-islower ├── 4-isalpha ├── 7-last_digit ├── 2-alphabet_x10 ├── 9-times_table ├── .0-putchar.c.swp ├── .8-24_hours.c.swp ├── .gitignore ├── 9-main.c ├── 1-main.c ├── 10-add.c ├── 10-main.c ├── 6-abs.c ├── 1-alphabet.c ├── 0-putchar.c ├── main.h ├── 5-sign.c ├── 2-print_alphabet_x10.c ├── 7-print_last_digit.c ├── 8-24_hours.c ├── 11-print_to_98.c ├── 3-islower.c ├── 102-fibonacci.c ├── 103-fibonacci.c └── 101-natural.c ├── 0x13-more_singly_linked_lists ├── README.md ├── a ├── b ├── c ├── d ├── e ├── f ├── g ├── h ├── i ├── j ├── .2-add_nodeint.c.swp ├── .6-pop_listint.c.swp ├── .7-get_nodeint.c.swo ├── .7-get_nodeint.c.swp ├── 4-free_listint.c ├── 5-free_listint2.c ├── 1-listint_len.c ├── 0-print_listint.c └── 8-sum_listint.c ├── 0x04-more_functions_nested_loops ├── README.md ├── 2-mul ├── 6-lines ├── 0-isuper ├── 1-isdigit ├── 8-squares ├── 10-triangles ├── 7-diagonals ├── 9-fizz_buzz ├── .6-main.c.swp ├── 3-print_numbers ├── 5-more_numbers ├── .9-fizz_buzz.c.swp ├── 4-print_most_numbers ├── .5-more_numbers.c.swp ├── .8-print_square.c.swp ├── .7-print_diagonal.c.swp ├── 3-main.c ├── 5-main.c ├── 4-main.c ├── 2-mul.c ├── 8-main.c ├── 6-main.c ├── _putchar.c ├── 10-main.c ├── 7-main.c ├── 2-main.c ├── 1-isdigit.c ├── 1-main.c ├── 3-print_numbers.c ├── 0-main.c ├── 6-print_line.c ├── 4-print_most_numbers.c ├── 101-main.c ├── main.h ├── 101-print_number.c ├── 5-more_numbers.c ├── 8-print_square.c ├── 7-print_diagonal.c ├── 0-isupper.c └── 10-print_triangle.c └── 0x01-variables_if_else_while ├── README.md ├── a.out ├── 1-last_digit ├── 8-print_base16 ├── 9-print_comb ├── 100-print_comb3 ├── 101-print_comb4 ├── 102-print_comb5 ├── 2-print_alphabet ├── 4-print_alphabt ├── 5-print_numbers ├── 6-print_numberz ├── 7-print_tebahpla ├── 3-print_alphabets ├── .4-print_alphabt.c.swp ├── .6-print_numberz.c.swp ├── 0-positive_or_negative ├── 5-print_numbers.c ├── 7-print_tebahpla.c ├── 6-print_numberz.c ├── 8-print_base16.c ├── 2-print_alphabet.c ├── 9-print_comb.c ├── 4-print_alphabt.c ├── 3-print_alphabets.c ├── 0-positive_or_negative.c └── 100-print_comb3.c /0x15-file_io/hello: -------------------------------------------------------------------------------- 1 | world -------------------------------------------------------------------------------- /0x03-debugging/README.md: -------------------------------------------------------------------------------- 1 | readme file 2 | -------------------------------------------------------------------------------- /0x0D-preprocessor/README.md: -------------------------------------------------------------------------------- 1 | Preprocessor 2 | -------------------------------------------------------------------------------- /0x15-file_io/README.md: -------------------------------------------------------------------------------- 1 | 0x15. C - File I/O 2 | -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/102-result: -------------------------------------------------------------------------------- 1 | 906609 2 | -------------------------------------------------------------------------------- /0x0C-more_malloc_free/README.md: -------------------------------------------------------------------------------- 1 | more on malloc 2 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4:_20191031192705: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4:_20191031192707: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x1A-hash_tables/README.md: -------------------------------------------------------------------------------- 1 | 0x1A. C - Hash tables 2 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-main_20191031141309.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/1-main_20191031153653.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/2-main_20191031154620.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/3-main_20191031180435.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-main_20191031190119.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/README_20191031141209.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/lists_20191031141537.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/101-password: -------------------------------------------------------------------------------- 1 | Congratulations! 2 | -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/100-password: -------------------------------------------------------------------------------- 1 | en C Pyfo neZ 2 | -------------------------------------------------------------------------------- /0x00-hello_world/1-compiler: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | gcc -c $CFILE 3 | -------------------------------------------------------------------------------- /0x00-hello_world/2-assembler: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | gcc -S $CFILE 3 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/101-crackme_password: -------------------------------------------------------------------------------- 1 | bc123 2 | -------------------------------------------------------------------------------- /0x08-recursion/README.md: -------------------------------------------------------------------------------- 1 | c projects regarding recurssion 2 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031141508.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/1-list_len_20191031153205.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-first_20191031191452.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-main_20191031190849.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/2-add_node_20191031154711.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031190132.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/_putchar_20191031151111.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x00-hello_world/3-name: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | gcc -o cisfun $CFILE 3 | -------------------------------------------------------------------------------- /0x00-hello_world/README.md: -------------------------------------------------------------------------------- 1 | My readme file for 0x00-hello_world 2 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/3-add_node_end_20191031180517.c: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/README.md: -------------------------------------------------------------------------------- 1 | 0x12. C - Singly linked lists 2 | -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/README.md: -------------------------------------------------------------------------------- 1 | 0x17. C - Doubly linked lists 2 | -------------------------------------------------------------------------------- /0x00-hello_world/0-preprocessor: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | gcc -E $CFILE -o c 3 | -------------------------------------------------------------------------------- /0x00-hello_world/100-intel: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | gcc -S -masm=intel $CFILE 3 | -------------------------------------------------------------------------------- /0x10-variadic_functions/README.md: -------------------------------------------------------------------------------- 1 | a directory for variodic funtion 2 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/101-hello_holberton_20191031190514.asm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A directory containing files that talks about c debugging 2 | -------------------------------------------------------------------------------- /0x09-static_libraries/README.md: -------------------------------------------------------------------------------- 1 | a directory for static library projects 2 | -------------------------------------------------------------------------------- /0x0A-argc_argv/README.md: -------------------------------------------------------------------------------- 1 | a directory for argc and argv in main program 2 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/README.md: -------------------------------------------------------------------------------- 1 | 0x05. C - Pointers, arrays and strings 2 | -------------------------------------------------------------------------------- /0x0B-malloc_free/README.md: -------------------------------------------------------------------------------- 1 | a directory for dybamic memeory allocation projects 2 | -------------------------------------------------------------------------------- /0x0F-function_pointers/README.md: -------------------------------------------------------------------------------- 1 | A directory for pointer to function projects 2 | -------------------------------------------------------------------------------- /0x1C-makefiles/0-Makefile: -------------------------------------------------------------------------------- 1 | all: main.c school.c 2 | gcc main.c school.c -o school -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/README.md: -------------------------------------------------------------------------------- 1 | 0x06. C - More pointers, arrays and strings 2 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/101-crackme_password: -------------------------------------------------------------------------------- 1 | bc123 2 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/README.md: -------------------------------------------------------------------------------- 1 | # 0x05. C - Pointers, arrays and strings. 2 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/README.md: -------------------------------------------------------------------------------- 1 | a directory for structure and typedof projects 2 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/README_20191031141240.md: -------------------------------------------------------------------------------- 1 | 0x12. C - Singly linked lists 2 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/README.md: -------------------------------------------------------------------------------- 1 | A directory for projects that deals with bit manipulation 2 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/README.md: -------------------------------------------------------------------------------- 1 | This is a function and nested loop project directory 2 | 3 | -------------------------------------------------------------------------------- /0x09-static_libraries/create_static_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | gcc -c *.c -fpic 3 | ar rcs liball.a *.o 4 | -------------------------------------------------------------------------------- /0x15-file_io/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x15-file_io/a -------------------------------------------------------------------------------- /0x15-file_io/b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x15-file_io/b -------------------------------------------------------------------------------- /0x15-file_io/c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x15-file_io/c -------------------------------------------------------------------------------- /0x15-file_io/cp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x15-file_io/cp -------------------------------------------------------------------------------- /0x0A-argc_argv/add: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0A-argc_argv/add -------------------------------------------------------------------------------- /0x0A-argc_argv/mul: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0A-argc_argv/mul -------------------------------------------------------------------------------- /0x0B-malloc_free/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0B-malloc_free/a -------------------------------------------------------------------------------- /0x0B-malloc_free/c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0B-malloc_free/c -------------------------------------------------------------------------------- /0x0B-malloc_free/f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0B-malloc_free/f -------------------------------------------------------------------------------- /0x0B-malloc_free/g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0B-malloc_free/g -------------------------------------------------------------------------------- /0x0B-malloc_free/s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0B-malloc_free/s -------------------------------------------------------------------------------- /0x1A-hash_tables/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x1A-hash_tables/a -------------------------------------------------------------------------------- /0x1A-hash_tables/b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x1A-hash_tables/b -------------------------------------------------------------------------------- /0x1A-hash_tables/d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x1A-hash_tables/d -------------------------------------------------------------------------------- /0x1C-makefiles/1-Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | SRC = main.c school.c 3 | all: $(SRC) 4 | $(CC) $(SRC) -o school 5 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/README.md: -------------------------------------------------------------------------------- 1 | # 0x05. C - Pointers, arrays and strings. 2 | -------------------------------------------------------------------------------- /0x08-recursion/4-pow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/4-pow -------------------------------------------------------------------------------- /0x0A-argc_argv/args: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0A-argc_argv/args -------------------------------------------------------------------------------- /0x0A-argc_argv/nargs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0A-argc_argv/nargs -------------------------------------------------------------------------------- /0x00-hello_world/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/a.out -------------------------------------------------------------------------------- /0x00-hello_world/c.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/c.exe -------------------------------------------------------------------------------- /0x00-hello_world/cisfun: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/cisfun -------------------------------------------------------------------------------- /0x00-hello_world/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/main.o -------------------------------------------------------------------------------- /0x00-hello_world/quote: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/quote -------------------------------------------------------------------------------- /0x00-hello_world/size32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/size32 -------------------------------------------------------------------------------- /0x00-hello_world/size64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/size64 -------------------------------------------------------------------------------- /0x08-recursion/5-sqrt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/5-sqrt -------------------------------------------------------------------------------- /0x08-recursion/6-prime: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/6-prime -------------------------------------------------------------------------------- /0x0A-argc_argv/change: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0A-argc_argv/change -------------------------------------------------------------------------------- /0x0B-malloc_free/args: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0B-malloc_free/args -------------------------------------------------------------------------------- /0x0B-malloc_free/strtow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0B-malloc_free/strtow -------------------------------------------------------------------------------- /0x0C-more_malloc_free/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0C-more_malloc_free/a -------------------------------------------------------------------------------- /0x0D-preprocessor/4-sum.h: -------------------------------------------------------------------------------- 1 | #ifndef SUM_H 2 | #define SUM_H 3 | #define SUM(x, y) (x + y) 4 | #endif /* SUM_H */ 5 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x14-bit_manipulation/a -------------------------------------------------------------------------------- /0x14-bit_manipulation/b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x14-bit_manipulation/b -------------------------------------------------------------------------------- /0x0E-structures_typedef/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0E-structures_typedef/a -------------------------------------------------------------------------------- /0x0E-structures_typedef/b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0E-structures_typedef/b -------------------------------------------------------------------------------- /0x0E-structures_typedef/c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0E-structures_typedef/c -------------------------------------------------------------------------------- /0x0E-structures_typedef/d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0E-structures_typedef/d -------------------------------------------------------------------------------- /0x0E-structures_typedef/e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0E-structures_typedef/e -------------------------------------------------------------------------------- /0x0E-structures_typedef/f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0E-structures_typedef/f -------------------------------------------------------------------------------- /0x0F-function_pointers/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0F-function_pointers/a -------------------------------------------------------------------------------- /0x0F-function_pointers/b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0F-function_pointers/b -------------------------------------------------------------------------------- /0x0F-function_pointers/c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0F-function_pointers/c -------------------------------------------------------------------------------- /0x10-variadic_functions/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x10-variadic_functions/a -------------------------------------------------------------------------------- /0x10-variadic_functions/b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x10-variadic_functions/b -------------------------------------------------------------------------------- /0x10-variadic_functions/c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x10-variadic_functions/c -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/README.md: -------------------------------------------------------------------------------- 1 | a directory whtich contains project tasks on advanced linked list concepsts 2 | -------------------------------------------------------------------------------- /0x00-hello_world/cisfun.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/cisfun.exe -------------------------------------------------------------------------------- /0x08-recursion/101-wildcmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/101-wildcmp -------------------------------------------------------------------------------- /0x08-recursion/3-factorial: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/3-factorial -------------------------------------------------------------------------------- /0x09-static_libraries/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/main.o -------------------------------------------------------------------------------- /0x09-static_libraries/quote: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/quote -------------------------------------------------------------------------------- /0x0A-argc_argv/.4-add.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0A-argc_argv/.4-add.c.swp -------------------------------------------------------------------------------- /0x0A-argc_argv/mynewnameis: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0A-argc_argv/mynewnameis -------------------------------------------------------------------------------- /0x0F-function_pointers/calc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0F-function_pointers/calc -------------------------------------------------------------------------------- /0x0F-function_pointers/main: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0F-function_pointers/main -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x17-doubly_linked_lists/c -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x17-doubly_linked_lists/d -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x17-doubly_linked_lists/e -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x17-doubly_linked_lists/h -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x17-doubly_linked_lists/i -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/README.md: -------------------------------------------------------------------------------- 1 | A directory that contains multiple files that deals with function and nested loops 2 | -------------------------------------------------------------------------------- /0x08-recursion/100-palindrome: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/100-palindrome -------------------------------------------------------------------------------- /0x09-static_libraries/3-puts.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/3-puts.o -------------------------------------------------------------------------------- /0x09-static_libraries/6-abs.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/6-abs.o -------------------------------------------------------------------------------- /0x09-static_libraries/liball.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/liball.a -------------------------------------------------------------------------------- /0x09-static_libraries/libmy.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/libmy.a -------------------------------------------------------------------------------- /0x0C-more_malloc_free/101-mul: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0C-more_malloc_free/101-mul -------------------------------------------------------------------------------- /0x0C-more_malloc_free/2-calloc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0C-more_malloc_free/2-calloc -------------------------------------------------------------------------------- /0x00-hello_world/.100-intel.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/.100-intel.swp -------------------------------------------------------------------------------- /0x00-hello_world/.6-sizes.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x00-hello_world/.6-sizes.c.swp -------------------------------------------------------------------------------- /0x01-variables_if_else_while/README.md: -------------------------------------------------------------------------------- 1 | This is a directory that deals about variables if else statementsa and aslo while statements 2 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/6-abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/6-abs -------------------------------------------------------------------------------- /0x02-functions_nested_loops/8-24: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/8-24 -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/0-98: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/0-98 -------------------------------------------------------------------------------- /0x08-recursion/0-puts_recursion: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/0-puts_recursion -------------------------------------------------------------------------------- /0x08-recursion/2-strlen_recursion: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/2-strlen_recursion -------------------------------------------------------------------------------- /0x09-static_libraries/0-isupper.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/0-isupper.o -------------------------------------------------------------------------------- /0x09-static_libraries/0-memset.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/0-memset.o -------------------------------------------------------------------------------- /0x09-static_libraries/0-strcat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/0-strcat.o -------------------------------------------------------------------------------- /0x09-static_libraries/1-isdigit.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/1-isdigit.o -------------------------------------------------------------------------------- /0x09-static_libraries/1-memcpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/1-memcpy.o -------------------------------------------------------------------------------- /0x09-static_libraries/1-strncat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/1-strncat.o -------------------------------------------------------------------------------- /0x09-static_libraries/100-atoi.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/100-atoi.o -------------------------------------------------------------------------------- /0x09-static_libraries/2-strchr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/2-strchr.o -------------------------------------------------------------------------------- /0x09-static_libraries/2-strlen.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/2-strlen.o -------------------------------------------------------------------------------- /0x09-static_libraries/2-strncpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/2-strncpy.o -------------------------------------------------------------------------------- /0x09-static_libraries/3-islower.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/3-islower.o -------------------------------------------------------------------------------- /0x09-static_libraries/3-strcmp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/3-strcmp.o -------------------------------------------------------------------------------- /0x09-static_libraries/3-strspn.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/3-strspn.o -------------------------------------------------------------------------------- /0x09-static_libraries/4-isalpha.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/4-isalpha.o -------------------------------------------------------------------------------- /0x09-static_libraries/4-strpbrk.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/4-strpbrk.o -------------------------------------------------------------------------------- /0x09-static_libraries/5-strstr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/5-strstr.o -------------------------------------------------------------------------------- /0x09-static_libraries/9-strcpy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/9-strcpy.o -------------------------------------------------------------------------------- /0x09-static_libraries/_putchar.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x09-static_libraries/_putchar.o -------------------------------------------------------------------------------- /0x0C-more_malloc_free/100-realloc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0C-more_malloc_free/100-realloc -------------------------------------------------------------------------------- /0x0D-preprocessor/1-pi.h: -------------------------------------------------------------------------------- 1 | #ifndef OBJECT_LIKE_MACRO_H 2 | #define OBJECT_LIKE_MACRO_H 3 | 4 | #define PI 3.14159265359 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/0-print: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x12-singly_linked_lists/0-print -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/a -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/b -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/c -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/d -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/e -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/f -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/g -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/h -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/i -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/j: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/j -------------------------------------------------------------------------------- /0x01-variables_if_else_while/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/a.out -------------------------------------------------------------------------------- /0x02-functions_nested_loops/10-add: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/10-add -------------------------------------------------------------------------------- /0x02-functions_nested_loops/5-sign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/5-sign -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/1-swap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/1-swap -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/3-puts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/3-puts -------------------------------------------------------------------------------- /0x0C-more_malloc_free/3-array_range: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0C-more_malloc_free/3-array_range -------------------------------------------------------------------------------- /0x02-functions_nested_loops/0-putchar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/0-putchar -------------------------------------------------------------------------------- /0x02-functions_nested_loops/1-alphabet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/1-alphabet -------------------------------------------------------------------------------- /0x02-functions_nested_loops/3-islower: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/3-islower -------------------------------------------------------------------------------- /0x02-functions_nested_loops/4-isalpha: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/4-isalpha -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/2-mul: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/2-mul -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/100-atoi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/100-atoi -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/2-strlen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/2-strlen -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/6-puts2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/6-puts2 -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/9-strcpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/9-strcpy -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/0-strcat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x06-pointers_arrays_strings/0-strcat -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/1-strncat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x06-pointers_arrays_strings/1-strncat -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/3-strcmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x06-pointers_arrays_strings/3-strcmp -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/crackme2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x07-pointers_arrays_strings/crackme2 -------------------------------------------------------------------------------- /0x08-recursion/.0-puts_recursion.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/.0-puts_recursion.c.swp -------------------------------------------------------------------------------- /0x08-recursion/1-print_rev_recursion: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/1-print_rev_recursion -------------------------------------------------------------------------------- /0x0B-malloc_free/.0-create_array.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0B-malloc_free/.0-create_array.c.swp -------------------------------------------------------------------------------- /0x0C-more_malloc_free/1-string_nconcat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0C-more_malloc_free/1-string_nconcat -------------------------------------------------------------------------------- /0x0D-preprocessor/0-object_like_macro.h: -------------------------------------------------------------------------------- 1 | #ifndef OBJECT_LIKE_MACRO_H 2 | #define OBJECT_LIKE_MACRO_H 3 | 4 | #define SIZE 1024 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /0x0D-preprocessor/3-function_like_macro.h: -------------------------------------------------------------------------------- 1 | #ifndef ABS_H 2 | #define ABS_H 3 | #define ABS(x) (((x) < 0) ? -(x) : (x)) 4 | #endif /* ABS_H */ 5 | -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/crackme4.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x17-doubly_linked_lists/crackme4.pyc -------------------------------------------------------------------------------- /0x02-functions_nested_loops/7-last_digit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/7-last_digit -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/6-lines: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/6-lines -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/101-keygen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/101-keygen -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/4-print_rev: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/4-print_rev -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/7-puts_half: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/7-puts_half -------------------------------------------------------------------------------- /0x0E-structures_typedef/.4-new_dog.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0E-structures_typedef/.4-new_dog.c.swp -------------------------------------------------------------------------------- /0x1A-hash_tables/.3-hash_table_set.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x1A-hash_tables/.3-hash_table_set.c.swp -------------------------------------------------------------------------------- /0x01-variables_if_else_while/1-last_digit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/1-last_digit -------------------------------------------------------------------------------- /0x01-variables_if_else_while/8-print_base16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/8-print_base16 -------------------------------------------------------------------------------- /0x01-variables_if_else_while/9-print_comb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/9-print_comb -------------------------------------------------------------------------------- /0x02-functions_nested_loops/2-alphabet_x10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/2-alphabet_x10 -------------------------------------------------------------------------------- /0x02-functions_nested_loops/9-times_table: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/9-times_table -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/0-isuper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/0-isuper -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/1-isdigit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/1-isdigit -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/8-squares: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/8-squares -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/5-rev_string: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/5-rev_string -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/8-print_array: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/8-print_array -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/.2-main.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x06-pointers_arrays_strings/.2-main.c.swp -------------------------------------------------------------------------------- /0x08-recursion/.1-print_rev_recursion.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x08-recursion/.1-print_rev_recursion.c.swp -------------------------------------------------------------------------------- /0x0F-function_pointers/.3-get_op_func.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x0F-function_pointers/.3-get_op_func.c.swp -------------------------------------------------------------------------------- /0x1C-makefiles/2-Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | SRC = main.c school.c 3 | OBJ = $(SRC:.c=.o) 4 | NAME = school 5 | 6 | all: $(OBJ) 7 | $(CC) $(OBJ) -o $(NAME) 8 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/100-print_comb3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/100-print_comb3 -------------------------------------------------------------------------------- /0x01-variables_if_else_while/101-print_comb4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/101-print_comb4 -------------------------------------------------------------------------------- /0x01-variables_if_else_while/102-print_comb5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/102-print_comb5 -------------------------------------------------------------------------------- /0x01-variables_if_else_while/2-print_alphabet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/2-print_alphabet -------------------------------------------------------------------------------- /0x01-variables_if_else_while/4-print_alphabt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/4-print_alphabt -------------------------------------------------------------------------------- /0x01-variables_if_else_while/5-print_numbers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/5-print_numbers -------------------------------------------------------------------------------- /0x01-variables_if_else_while/6-print_numberz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/6-print_numberz -------------------------------------------------------------------------------- /0x01-variables_if_else_while/7-print_tebahpla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/7-print_tebahpla -------------------------------------------------------------------------------- /0x02-functions_nested_loops/.0-putchar.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/.0-putchar.c.swp -------------------------------------------------------------------------------- /0x02-functions_nested_loops/.8-24_hours.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x02-functions_nested_loops/.8-24_hours.c.swp -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/10-triangles: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/10-triangles -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/7-diagonals: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/7-diagonals -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/9-fizz_buzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/9-fizz_buzz -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/.1-strncat.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x06-pointers_arrays_strings/.1-strncat.c.swp -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/.3-strcmp.c.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x06-pointers_arrays_strings/.3-strcmp.c.swo -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/.3-strcmp.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x06-pointers_arrays_strings/.3-strcmp.c.swp -------------------------------------------------------------------------------- /0x01-variables_if_else_while/3-print_alphabets: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/3-print_alphabets -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/.6-main.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/.6-main.c.swp -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/3-print_numbers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/3-print_numbers -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/5-more_numbers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/5-more_numbers -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/.5-rev_string.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/.5-rev_string.c.swp -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/.7-puts_half.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/.7-puts_half.c.swp -------------------------------------------------------------------------------- /0x10-variadic_functions/.1-print_numbers.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x10-variadic_functions/.1-print_numbers.c.swp -------------------------------------------------------------------------------- /0x12-singly_linked_lists/101-hello_holberton.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x12-singly_linked_lists/101-hello_holberton.o -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/.8-print_array.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x05-pointers_arrays_strings/.8-print_array.c.swp -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031142101.c: -------------------------------------------------------------------------------- 1 | /** 2 | * main - check the code for Holberton School students. 3 | * 4 | * Return: Always 0. 5 | */ 6 | -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/.2-add_nodeint.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/.2-add_nodeint.c.swp -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/.6-pop_listint.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/.6-pop_listint.c.swp -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/.7-get_nodeint.c.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/.7-get_nodeint.c.swo -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/.7-get_nodeint.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x13-more_singly_linked_lists/.7-get_nodeint.c.swp -------------------------------------------------------------------------------- /0x1C-makefiles/m.h: -------------------------------------------------------------------------------- 1 | #ifndef __M_H__ 2 | #define __M_H__ 3 | 4 | #include 5 | #include 6 | 7 | void print_school(void); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/.4-print_alphabt.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/.4-print_alphabt.c.swp -------------------------------------------------------------------------------- /0x01-variables_if_else_while/.6-print_numberz.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/.6-print_numberz.c.swp -------------------------------------------------------------------------------- /0x01-variables_if_else_while/0-positive_or_negative: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x01-variables_if_else_while/0-positive_or_negative -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/.9-fizz_buzz.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/.9-fizz_buzz.c.swp -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/4-print_most_numbers: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/4-print_most_numbers -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/.5-more_numbers.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/.5-more_numbers.c.swp -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/.8-print_square.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/.8-print_square.c.swp -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/.7-print_diagonal.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x04-more_functions_nested_loops/.7-print_diagonal.c.swp -------------------------------------------------------------------------------- /0x02-functions_nested_loops/.gitignore: -------------------------------------------------------------------------------- 1 | _putchar.c 2 | main.c 3 | 1-main.c 4 | 2-main.c 5 | 3-main.c 6 | 4-main.c 7 | 5-main.c 8 | 6-main.c 9 | 7-main.c 10 | 8-main.c 11 | 9-man.c 12 | -------------------------------------------------------------------------------- /0x00-hello_world/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - Entry point 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /0x09-static_libraries/main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | int main(void) 4 | { 5 | _puts("\"At the end of the day, my goal was to be the best hacker\"\n\t- Kevin Mitnick"); 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/crackme2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijsamuael/alx-low_level_programming/HEAD/0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/crackme2 -------------------------------------------------------------------------------- /0x1C-makefiles/main.c: -------------------------------------------------------------------------------- 1 | #include "m.h" 2 | 3 | /** 4 | * main - Entry point 5 | * 6 | * Return: Always 7 | */ 8 | int main(void) 9 | { 10 | print_school(); 11 | return (EXIT_SUCCESS); 12 | } 13 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/9-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | times_table(); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/1-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_alphabet(); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/3-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_numbers(); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/5-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | more_numbers(); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x10-variadic_functions/3-main.c: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * main - check the code 4 | * 5 | * Return: Always 0. 6 | */ 7 | int main(void) 8 | { 9 | print_all("ceis", 'B', 3, "stSchool"); 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/4-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_most_numbers(); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x0D-preprocessor/2-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | *main- prints file name 4 | * 5 | *Return: Always 0 6 | */ 7 | 8 | int main(void) 9 | { 10 | 11 | printf("%s\n", __FILE__); 12 | 13 | return (0); 14 | } 15 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031195027.c: -------------------------------------------------------------------------------- 1 | void free_list(list_t *head) 2 | { 3 | while (head->next != NULL) 4 | { 5 | free(head->str); 6 | free(head); 7 | head = head->next; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031195455.c: -------------------------------------------------------------------------------- 1 | void free_list(list_t *head) 2 | { 3 | while (head->next != NULL) 4 | { 5 | free(head->str); 6 | free(head); 7 | head = head->next; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031142227.c: -------------------------------------------------------------------------------- 1 | /** 2 | * main - check the code for Holberton School students. 3 | * 4 | * Return: Always 0. 5 | */ 6 | size_t print_list(const list_t *h) 7 | { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-first_20191031191727.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | void myStartupFun (void) __attribute__ ((constructor)); 3 | 4 | void myStartupFun (void) 5 | { 6 | printf ("startup code before main()\n"); 7 | } 8 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/10-add.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * add - add two given numbers 4 | * 5 | * Return: The sum of two giben numbers 6 | */ 7 | int add(int num1, int num2) 8 | { 9 | return (num1 + num2); 10 | } 11 | -------------------------------------------------------------------------------- /0x08-recursion/0-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | _puts_recursion("Puts with recursion"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x08-recursion/1-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | _print_rev_recursion("\nColton Walker"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/0-reset_to_98.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * reset_to_98 - reset using pointer 4 | * @n: the number to be pointed 5 | * Return: void 6 | */ 7 | void reset_to_98(int *n) 8 | { 9 | *n = 98; 10 | } 11 | -------------------------------------------------------------------------------- /0x09-static_libraries/2-strlen.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "string.h" 3 | /** 4 | * _strlen - finds the length of the string 5 | * @s: stirng 6 | * Return: void 7 | */ 8 | int _strlen(char *s) 9 | { 10 | return (strlen(s)); 11 | } 12 | -------------------------------------------------------------------------------- /0x00-hello_world/4-puts.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | *main - Entry point 5 | * 6 | *Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | puts("\"Programming is like building a multilingual puzzle"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/2-strlen.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "string.h" 3 | /** 4 | * _strlen - finds the length of the string 5 | * @s: stirng 6 | * Return: void 7 | */ 8 | int _strlen(char *s) 9 | { 10 | return (strlen(s)); 11 | } 12 | -------------------------------------------------------------------------------- /0x10-variadic_functions/2-main.c: -------------------------------------------------------------------------------- 1 | #include "variadic_functions.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_strings(", ", 2, "Jay", "Django"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/1-list_len_20191031153734.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print list. 5 | * @h: list. 6 | * Return: The elements linked. 7 | */ 8 | 9 | size_t list_len(const list_t *h) 10 | { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /0x10-variadic_functions/1-main.c: -------------------------------------------------------------------------------- 1 | #include "variadic_functions.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_numbers(", ", 4, 0, 98, -1024, 402); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x00-hello_world/5-printf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - Entry point 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | printf("with proper grammar, but the outcome is a piece of art,\n"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/100-set_string.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * set_string - Sets the value of a pointer to a char. 5 | * @s: The pointer. 6 | * @to: The char. 7 | */ 8 | void set_string(char **s, char *to) 9 | { 10 | *s = to; 11 | } 12 | -------------------------------------------------------------------------------- /0x08-recursion/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * _putchar - Writes character to standard output 4 | * @c: the character to print 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int _putchar(char c) 9 | { 10 | return (write(1, &c, 1)); 11 | } 12 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/2-mul.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * mul - mulipty numbers 5 | * @a: number 1 6 | * @b: number 1 7 | * Return: the multiplication of the two numbers 8 | */ 9 | 10 | int mul(int a, int b) 11 | { 12 | return (a * b); 13 | } 14 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/8-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_square(2); 11 | print_square(10); 12 | print_square(0); 13 | return (0); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/6-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | char *str; 11 | 12 | str = "0123456789"; 13 | puts2(str); 14 | return (0); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-first_20191031191816.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | void myStartupFun (void) __attribute__ ((constructor)); 3 | 4 | void myStartupFun (void) 5 | { 6 | printf ("You're beat! and yet, you must allow,\nI bore my house upon my back!\n"); 7 | } 8 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-first_20191031191954.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | void myStartupFun(void) __attribute__ ((constructor)); 3 | 4 | void myStartupFun(void) 5 | { 6 | printf ("You're beat! and yet, you must allow,\n 7 | I bore my house upon my back!\n"); 8 | } 9 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-first_20191031192004.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | void myStartupFun(void) __attribute__ ((constructor)); 3 | 4 | void myStartupFun(void) 5 | { 6 | printf("You're beat! and yet, you must allow,\n 7 | I bore my house upon my back!\n"); 8 | } 9 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/101-hello_holberton.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | 3 | message db "Hello, Holberton", 10 4 | 5 | section .text 6 | global main 7 | 8 | main: 9 | mov rax, 1 10 | mov rdi, 1 11 | mov rsi, message 12 | mov rdx, 17 13 | syscall 14 | -------------------------------------------------------------------------------- /0x03-debugging/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #include 5 | 6 | void positive_or_negative(int i); 7 | int largest_number(int, int, int); 8 | void print_remaining_days(int, int, int); 9 | int convert_day(int, int); 10 | 11 | #endif /* MAIN_H */ 12 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-first_20191031191934.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | void myStartupFun(void) __attribute__ ((constructor)); 3 | 4 | void myStartupFun(void) 5 | { 6 | printf ("You're beat! and yet, you must allow,\n 7 | I bore my house upon my back!\n"); 8 | } 9 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * _putchar - Writes character to standard output 4 | * @c: the character to print 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int _putchar(char c) 9 | { 10 | return (write(1, &c, 1)); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /0x00-hello_world/101-quote.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | *main - Entry point 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | fprintf(stderr, "and that piece of art is useful\" - Dora \ 11 | Korpar, 2015-10-19\n"); 12 | return (1); 13 | } 14 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/10-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int n; 12 | 13 | n = add(89, 9); 14 | printf("%d\n", n); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /0x03-debugging/0-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - tests function that prints if integer is positive or negative 5 | * Return: 0 6 | */ 7 | 8 | int main(void) 9 | { 10 | int i; 11 | 12 | i = 0; 13 | positive_or_negative(i); 14 | 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/6-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_line(0); 11 | print_line(2); 12 | print_line(10); 13 | print_line(-4); 14 | return (0); 15 | } 16 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/100-get_endianness.c: -------------------------------------------------------------------------------- 1 | /** 2 | * get_endianness - return the endianness of the machine 3 | * 4 | * Return: 0 for big endian, 1 for little endian 5 | */ 6 | int get_endianness(void) 7 | { 8 | int n = 1; 9 | 10 | return (*((char *) &n) + '0'); 11 | } 12 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/7-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | char *str; 11 | 12 | str = "0123456789"; 13 | puts_half(str); 14 | return (0); 15 | } 16 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * _putchar - Writes character to standard output 4 | * @c: the character to print 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int _putchar(char c) 9 | { 10 | return (write(1, &c, 1)); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/1-swap.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * swap_int - swaps two numbers 4 | * @a: number 1 5 | * @b: number 2 6 | * Return: void 7 | */ 8 | void swap_int(int *a, int *b) 9 | { 10 | int temp; 11 | 12 | temp = *a; 13 | *a = *b; 14 | *b = temp; 15 | } 16 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/100-set_string.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * set_string - Sets the value of a pointer to a char. 5 | * @s: The pointer. 6 | * @to: The char. 7 | */ 8 | void set_string(char **s, char *to) 9 | { 10 | *s = to; 11 | } 12 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/2-add_node_20191031154838.c: -------------------------------------------------------------------------------- 1 | i#include "lists.h" 2 | 3 | /** 4 | * add_note - print len. 5 | * @head: list. 6 | * @str: string. 7 | * Return: The elements linked. 8 | */ 9 | 10 | list_t *add_node(list_t **head, const char *str) 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/2-add_node_20191031154940.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * add_note - print len. 5 | * @head: list. 6 | * @str: string. 7 | * Return: The elements linked. 8 | */ 9 | 10 | list_t *add_node(list_t **head, const char *str) 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/10-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_triangle(2); 11 | print_triangle(10); 12 | print_triangle(1); 13 | print_triangle(0); 14 | return (0); 15 | } 16 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/7-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_diagonal(0); 11 | print_diagonal(2); 12 | print_diagonal(10); 13 | print_diagonal(-4); 14 | return (0); 15 | } 16 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/101-hello_holberton_20191031190532.asm: -------------------------------------------------------------------------------- 1 | section .data 2 | 3 | message db "Hello, Holberton", 10 4 | 5 | section .text 6 | global main 7 | 8 | main: 9 | mov rax, 1 10 | mov rdi, 1 11 | mov rsi, message 12 | mov rdx, 17 13 | syscall 14 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/5-print_numbers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - Entry point 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | int i; 11 | 12 | for (i = 0; i <= 9; i++) 13 | printf("%d", i); 14 | putchar('\n'); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/2-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | printf("%d\n", mul(98, 1024)); 12 | printf("%d\n", mul(-402, 4096)); 13 | return (0); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /0x09-static_libraries/1-isdigit.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * _isdigit - Printing small lettets 4 | * @c: a number 5 | * Return: whether the number is between o and 9 6 | */ 7 | int _isdigit(int c) 8 | { 9 | if (c >= '0' && c <= '9') 10 | return (1); 11 | else 12 | return (0); 13 | } 14 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/7-print_tebahpla.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - Entry point 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | int i = 122; 11 | 12 | for (i = 122; i >= 97; i--) 13 | putchar(i); 14 | putchar('\n'); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /0x08-recursion/2-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int n; 12 | 13 | n = _strlen_recursion("Corbin Coleman"); 14 | printf("%d\n", n); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /0x1C-makefiles/3-Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | SRC = main.c school.c 3 | OBJ = $(SRC:.c=.o) 4 | NAME = school 5 | RM = rm -f 6 | 7 | all: $(OBJ) 8 | $(CC) $(OBJ) -o $(NAME) 9 | 10 | clean: 11 | $(RM) *~ $(NAME) 12 | 13 | oclean: 14 | $(RM) $(OBJ) 15 | 16 | fclean: clean oclean 17 | 18 | re: fclean all 19 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/5-free_dog.c: -------------------------------------------------------------------------------- 1 | #include "dog.h" 2 | #include 3 | /** 4 | * free_dog - function that frees dogs 5 | * @d: dog pointer 6 | * 7 | */ 8 | void free_dog(dog_t *d) 9 | { 10 | if (d != NULL) 11 | { 12 | free(d->name); 13 | free(d->owner); 14 | free(d); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/1-isdigit.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * _isdigit - Printing small lettets 4 | * @c: a number 5 | * Return: whether the number is between o and 9 6 | */ 7 | int _isdigit(int c) 8 | { 9 | if (c >= '0' && c <= '9') 10 | return (1); 11 | else 12 | return (0); 13 | } 14 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/6-print_numberz.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - Entry point 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | int i; 11 | 12 | for (i = 0; i <= 9; i++) 13 | { 14 | putchar(i + '0'); 15 | } 16 | putchar('\n'); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x09-static_libraries/6-abs.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * _abs - pirntsints theabsolute functio of the numebr 5 | * @n: the number to be evvaluated 6 | * Return: the abslolute value of the number 7 | */ 8 | int _abs(int n) 9 | { 10 | if (n < 0) 11 | return (-n); 12 | else 13 | return (n); 14 | } 15 | -------------------------------------------------------------------------------- /0x0C-more_malloc_free/main.h: -------------------------------------------------------------------------------- 1 | void *malloc_checked(unsigned int b); 2 | char *string_nconcat(char *s1, char *s2, unsigned int n); 3 | void *_calloc(unsigned int nmemb, unsigned int size); 4 | int *array_range(int min, int max); 5 | void *_realloc(void *ptr, unsigned int old_size, unsigned int new_size); 6 | int _putchar(char); 7 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/6-abs.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * _abs - pirntsints theabsolute functio of the numebr 5 | * @n: the number to be evvaluated 6 | * Return: the abslolute value of the number 7 | */ 8 | int _abs(int n) 9 | { 10 | if (n < 0) 11 | return (-n); 12 | else 13 | return (n); 14 | } 15 | -------------------------------------------------------------------------------- /0x08-recursion/3-factorial.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * factorial - prints the factorial of a number 4 | * @n: a number 5 | * Return: the factorial of a number 6 | */ 7 | int factorial(int n) 8 | { 9 | if (n < 1) 10 | return (-1); 11 | if (n == 1) 12 | return (1); 13 | return (n * factorial(n - 1)); 14 | } 15 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/3-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | char *str; 11 | 12 | str = "I do not fear computers. I fear the lack of them - Isaac Asimov"; 13 | _puts(str); 14 | return (0); 15 | } 16 | -------------------------------------------------------------------------------- /0x0B-malloc_free/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/1-list_len.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * list_len - print len. 5 | * @h: list. 6 | * Return: The elements linked. 7 | */ 8 | 9 | size_t list_len(const list_t *h) 10 | { 11 | int i = 0; 12 | 13 | while (h != NULL) 14 | { 15 | h = h->next; 16 | i++; 17 | } 18 | return (i); 19 | } 20 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/100-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - check the code for Holberton School students. 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | printf("(A tortoise, having pretty good sense of a hare's nature, challenges one to a race.)\n"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/4-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | char *str; 11 | 12 | str = "I do not fear computers. I fear the lack of them - Isaac Asimov"; 13 | print_rev(str); 14 | return (0); 15 | } 16 | -------------------------------------------------------------------------------- /0x09-static_libraries/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x0A-argc_argv/0-whatsmyname.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - the entry of the program 5 | * @argc: the number of an argument 6 | * @argv: the array of arguments 7 | * Return: integer 8 | */ 9 | int main(__attribute__((unused)) int argc, char *argv[]) 10 | { 11 | printf("%s\n", argv[0]); 12 | return (0); 13 | } 14 | -------------------------------------------------------------------------------- /0x0C-more_malloc_free/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x0F-function_pointers/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/4-free_list.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * free_list - free list. 5 | * @head: head. 6 | * Return: NA. 7 | */ 8 | void free_list(list_t *head) 9 | { 10 | if (head == NULL) 11 | return; 12 | if (head->next != NULL) 13 | free_list(head->next); 14 | free(head->str); 15 | free(head); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x09-static_libraries/3-puts.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _puts - prints a string 5 | * @str: a stirng 6 | * Return: void 7 | */ 8 | void _puts(char *str) 9 | { 10 | unsigned long int i; 11 | 12 | for (i = 0; i < strlen(str); i++) 13 | { 14 | _putchar(str[i]); 15 | } 16 | _putchar('\n'); 17 | } 18 | -------------------------------------------------------------------------------- /0x0A-argc_argv/1-args.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - the main entry of the program 4 | * @argc: the number of the arguments 5 | * @argv: the array of the arguments 6 | * Return: an integer 7 | */ 8 | int main(int argc, __attribute__((unused)) char *argv[]) 9 | { 10 | printf("%d\n", argc - 1); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x0F-function_pointers/0-print_name.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "function_pointers.h" 3 | /** 4 | * print_name - prints a name 5 | * @name: the name to be pritned 6 | * @f: a function 7 | * Return: void 8 | */ 9 | void print_name(char *name, void (*f)(char *)) 10 | { 11 | if (name != NULL && f != NULL) 12 | f(name); 13 | } 14 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/1-alphabet.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * print_alphabet - Printing small lettets 4 | * 5 | * Return: void 6 | */ 7 | void print_alphabet(void) 8 | { 9 | char alpha; 10 | 11 | alpha = 'a'; 12 | 13 | while (alpha <= 'z') 14 | { 15 | _putchar(alpha); 16 | alpha++; 17 | } 18 | _putchar('\n'); 19 | } 20 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/0-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | *turn: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int n; 12 | 13 | n = 402; 14 | printf("n=%d\n", n); 15 | reset_to_98(&n); 16 | printf("n=%d\n", n); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/3-puts.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _puts - prints a string 5 | * @str: a stirng 6 | * Return: void 7 | */ 8 | void _puts(char *str) 9 | { 10 | unsigned long int i; 11 | 12 | for (i = 0; i < strlen(str); i++) 13 | { 14 | _putchar(str[i]); 15 | } 16 | _putchar('\n'); 17 | } 18 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/5-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char s[10] = "My School"; 12 | 13 | printf("%s\n", s); 14 | rev_string(s); 15 | printf("%s\n", s); 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /0x0C-more_malloc_free/0-malloc_checked.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "main.h" 3 | /** 4 | * malloc_checked - abebe beso bela 5 | * @b: bytes 6 | * Return:pointer 7 | */ 8 | 9 | void *malloc_checked(unsigned int b) 10 | { 11 | char *i; 12 | 13 | i = malloc(b); 14 | if (i == NULL) 15 | exit(98); 16 | else 17 | return (i); 18 | } 19 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/1-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char c; 12 | 13 | c = '0'; 14 | printf("%c: %d\n", c, _isdigit(c)); 15 | c = 'a'; 16 | printf("%c: %d\n", c, _isdigit(c)); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/3-print_numbers.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_numbers - it prints numbers form 0 to 9 5 | * 6 | * Return: the multiplication of the two numbers 7 | */ 8 | 9 | void print_numbers(void) 10 | { 11 | int i; 12 | 13 | for (i = 0; i <= 9; i++) 14 | _putchar('0' + i); 15 | _putchar('\n'); 16 | } 17 | -------------------------------------------------------------------------------- /0x08-recursion/0-puts_recursion.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _puts_recursion - prints a string 5 | * @s: a string 6 | * Return: void 7 | */ 8 | void _puts_recursion(char *s) 9 | { 10 | if (strlen(s) == 0) 11 | _putchar('\n'); 12 | else 13 | { 14 | _putchar(s[0]); 15 | _puts_recursion(s + 1); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /0x09-static_libraries/9-strcpy.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _strcpy - copy the string 5 | * @dest: destination string 6 | * @src: the source string wichin is to be copied 7 | * Return: a copied cahracter 8 | */ 9 | char *_strcpy(char *dest, char *src) 10 | { 11 | strcpy(dest, src); 12 | return (dest); 13 | } 14 | -------------------------------------------------------------------------------- /0x1C-makefiles/4-Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | SRC = main.c school.c 3 | OBJ = $(SRC:.c=.o) 4 | NAME = school 5 | RM = rm -f 6 | CFLAGS = -Wall -Werror -Wextra -pedantic 7 | 8 | all: $(OBJ) 9 | $(CC) $(OBJ) -o $(NAME) 10 | 11 | clean: 12 | $(RM) *~ $(NAME) 13 | 14 | oclean: 15 | $(RM) $(OBJ) 16 | 17 | fclean: clean oclean 18 | 19 | re: fclean all 20 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/0-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code. 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char c; 12 | 13 | c = 'A'; 14 | printf("%c: %d\n", c, _isupper(c)); 15 | c = 'a'; 16 | printf("%c: %d\n", c, _isupper(c)); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/9-strcpy.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _strcpy - copy the string 5 | * @dest: destination string 6 | * @src: the source string wichin is to be copied 7 | * Return: a copied cahracter 8 | */ 9 | char *_strcpy(char *dest, char *src) 10 | { 11 | strcpy(dest, src); 12 | return (dest); 13 | } 14 | -------------------------------------------------------------------------------- /0x08-recursion/1-print_rev_recursion.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _print_rev_recursion - prints a string in a reverse order 5 | * @s: a string 6 | * Return: void 7 | */ 8 | void _print_rev_recursion(char *s) 9 | { 10 | if (strlen(s) != 0) 11 | { 12 | _print_rev_recursion(s + 1); 13 | _putchar(*s); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /0x08-recursion/2-strlen_recursion.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _strlen_recursion - finds the length os the giben string 5 | * @s: a string 6 | * Return: the length of a string 7 | */ 8 | int _strlen_recursion(char *s) 9 | { 10 | if (*s == '\0') 11 | return (0); 12 | return (1 + _strlen_recursion(s + 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x08-recursion/main.h: -------------------------------------------------------------------------------- 1 | void _puts_recursion(char *s); 2 | void _print_rev_recursion(char *s); 3 | int _strlen_recursion(char *s); 4 | int factorial(int n); 5 | int _pow_recursion(int x, int y); 6 | int _sqrt_recursion(int n); 7 | int is_prime_number(int n); 8 | int is_palindrome(char *s); 9 | int wildcmp(char *s1, char *s2); 10 | int _putchar(char c); 11 | -------------------------------------------------------------------------------- /0x09-static_libraries/3-strcmp.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _strcmp - function that compares two strings. 5 | * @s1: primera cadena. 6 | * @s2: segunda cadena. 7 | * Return: 0. 8 | */ 9 | 10 | int _strcmp(char *s1, char *s2) 11 | { 12 | int result; 13 | 14 | result = strcmp(s1, s2); 15 | return (result); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031144250.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | 10 | while (h != NULL) 11 | { 12 | printf("%d - ", h -> len); 13 | h = h -> next; 14 | } 15 | printf("\n"); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031144435.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | printf("%d - ", h -> len); 13 | h = h -> next; 14 | } 15 | i++; 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031144438.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | printf("%d - ", h -> len); 13 | h = h -> next; 14 | } 15 | i++; 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031144440.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | printf("%d - ", h -> len); 13 | h = h -> next; 14 | } 15 | i++; 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/1-list_len_20191031154145.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print list. 5 | * @h: list. 6 | * Return: The elements linked. 7 | */ 8 | 9 | size_t list_len(const list_t *h) 10 | { 11 | int i = 0; 12 | 13 | while (h != NULL) 14 | { 15 | h = h->next; 16 | i++; 17 | } 18 | return (i); 19 | } 20 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/1-list_len_20191031154346.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * list_len - print len. 5 | * @h: list. 6 | * Return: The elements linked. 7 | */ 8 | 9 | size_t list_len(const list_t *h) 10 | { 11 | int i = 0; 12 | 13 | while (h != NULL) 14 | { 15 | h = h->next; 16 | i++; 17 | } 18 | return (i); 19 | } 20 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-main_20191031190909.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - check the code for Holberton School students. 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | printf("(A tortoise, having pretty good sense of a hare's nature, challenges one to a race.)\n"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-main_20191031190910.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - check the code for Holberton School students. 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | printf("(A tortoise, having pretty good sense of a hare's nature, challenges one to a race.)\n"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-main_20191031190924.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - check the code for Holberton School students. 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | printf("(A tortoise, having pretty good sense of a hare's nature, challenges one to a race.)\n"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-main_20191031190925.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - check the code for Holberton School students. 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | printf("(A tortoise, having pretty good sense of a hare's nature, challenges one to a race.)\n"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-main_20191031190926.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - check the code for Holberton School students. 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | printf("(A tortoise, having pretty good sense of a hare's nature, challenges one to a race.)\n"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-main_20191031190927.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - check the code for Holberton School students. 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | printf("(A tortoise, having pretty good sense of a hare's nature, challenges one to a race.)\n"); 11 | return (0); 12 | } 13 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/8-print_base16.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - Entry point 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | 9 | int main(void) 10 | { 11 | int i; 12 | 13 | for (i = 0; i <= 9; i++) 14 | putchar(i + '0'); 15 | for (i = 97; i <= 102; i++) 16 | putchar(i); 17 | putchar('\n'); 18 | return (0); 19 | } 20 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/3-strcmp.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _strcmp - function that compares two strings. 5 | * @s1: primera cadena. 6 | * @s2: segunda cadena. 7 | * Return: 0. 8 | */ 9 | 10 | int _strcmp(char *s1, char *s2) 11 | { 12 | int result; 13 | 14 | result = strcmp(s1, s2); 15 | return (result); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031200304.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * free_list - free list. 5 | * @head: head. 6 | * Return: NA. 7 | */ 8 | void free_list(list_t *head) 9 | { 10 | if (head == NULL) 11 | return; 12 | if (head->next != NULL) 13 | free_list(head->next); 14 | free(head->str); 15 | free(head); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/_putchar_20191031151150.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/2-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char *str; 12 | int len; 13 | 14 | str = "My first strlen!"; 15 | len = _strlen(str); 16 | printf("%d\n", len); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/5-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char *s = "hello, world"; 12 | char *f = "world"; 13 | char *t; 14 | 15 | t = _strstr(s, f); 16 | printf("%s\n", t); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x09-static_libraries/0-strcat.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * _strcat- function that concatenates two strings. 6 | * 7 | * @dest: pointer to destination char 8 | * @src: pointer to source char 9 | * Return: char 10 | */ 11 | 12 | char *_strcat(char *dest, char *src) 13 | { 14 | strcat(dest, src); 15 | return (dest); 16 | } 17 | -------------------------------------------------------------------------------- /0x09-static_libraries/2-strncpy.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _strncpy - function that copies a string.. 5 | * @src: cadena a copiar 6 | * @dest: destino de la cadena. 7 | * @n: number. 8 | * Return: void 9 | */ 10 | 11 | char *_strncpy(char *dest, char *src, int n) 12 | { 13 | strncpy(dest, src, n); 14 | return (dest); 15 | } 16 | -------------------------------------------------------------------------------- /0x0A-argc_argv/2-args.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - the entry of the program 4 | * @argc: number of argumbets 5 | * @argv: the array of arguments 6 | * Return: 0 if success 7 | */ 8 | int main(int argc, char *argv[]) 9 | { 10 | int i; 11 | 12 | for (i = 0; i < argc; i++) 13 | { 14 | printf("%s\n", argv[i]); 15 | } 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/2-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dog.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | struct dog my_dog; 12 | 13 | my_dog.name = "Poppy"; 14 | my_dog.age = 3.5; 15 | my_dog.owner = "Bob"; 16 | print_dog(&my_dog); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x0F-function_pointers/function_pointers.h: -------------------------------------------------------------------------------- 1 | #ifndef _FUNCTION_POINTERS_H_ 2 | #define _FUNCTION_POINTERS_H_ 3 | 4 | void print_name(char *name, void (*f)(char *)); 5 | void array_iterator(int *array, size_t size, void (*action)(int)); 6 | int int_index(int *array, int size, int (*cmp)(int)); 7 | int _putchar(char c); 8 | 9 | #endif /* _FUNCTION_POINTERS_H_ */ 10 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/100-first.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | void myStartupFun(void) __attribute__ ((constructor)); 3 | /** 4 | * myStartupFun - start before main. 5 | * @void: input. 6 | * Return: text. 7 | */ 8 | void myStartupFun(void) 9 | { 10 | printf("You're beat! and yet, you must allow,\n"); 11 | printf("I bore my house upon my back!\n"); 12 | } 13 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/2-print_alphabet.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * main - Entry point 6 | * 7 | * Return: Always 0 (Success) 8 | */ 9 | 10 | int main(void) 11 | 12 | { 13 | int n = 97; 14 | 15 | while (n <= 122) 16 | { 17 | putchar(n); 18 | n++; 19 | } 20 | putchar('\n'); 21 | 22 | return (0); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * _putchar - writes the character c to stdout 5 | * @c: The character to print 6 | * 7 | * Return: On success 1. 8 | * On error, -1 is returned, and errno is set appropriately. 9 | */ 10 | int _putchar(char c) 11 | { 12 | return (write(1, &c, 1)); 13 | } 14 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031144607.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | printf("%d - ", h -> len); 13 | h = h -> next; 14 | i++; 15 | } 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031144718.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | printf("[%d] ", h -> len); 13 | h = h -> next; 14 | i++; 15 | } 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031144805.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | printf("[%d]\n", h -> len); 13 | h = h -> next; 14 | i++; 15 | } 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/0-strcat.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * _strcat- function that concatenates two strings. 6 | * 7 | * @dest: pointer to destination char 8 | * @src: pointer to source char 9 | * Return: char 10 | */ 11 | 12 | char *_strcat(char *dest, char *src) 13 | { 14 | strcat(dest, src); 15 | return (dest); 16 | } 17 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/2-strncpy.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * _strncpy - function that copies a string.. 5 | * @src: cadena a copiar 6 | * @dest: destino de la cadena. 7 | * @n: number. 8 | * Return: void 9 | */ 10 | 11 | char *_strncpy(char *dest, char *src, int n) 12 | { 13 | strncpy(dest, src, n); 14 | return (dest); 15 | } 16 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/4-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | 10 | int main(void) 11 | { 12 | char *s = "hello, world"; 13 | char *f = "world"; 14 | char *t; 15 | 16 | t = _strpbrk(s, f); 17 | printf("%s\n", t); 18 | return (0); 19 | } 20 | -------------------------------------------------------------------------------- /0x0B-malloc_free/4-free_grid.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * free_grid - function that frees 6 | * @grid: array to free 7 | * @height: height of the array 8 | * Return: none 9 | */ 10 | 11 | void free_grid(int **grid, int height) 12 | { 13 | int i; 14 | 15 | for (i = 0; i < height; i++) 16 | free(grid[i]); 17 | free(grid); 18 | } 19 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031143101.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - check the code for Holberton School students. 4 | * 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | list_t *i = h; 10 | 11 | while (i! = NULL) 12 | { 13 | printf("%d - ", i -> len); 14 | i = i -> ste; 15 | } 16 | printf("\n"); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-first_20191031192102.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | void myStartupFun(void) __attribute__ ((constructor)); 3 | /** 4 | * myStartupFun - start before main. 5 | * @void: input. 6 | * Return: text. 7 | */ 8 | void myStartupFun(void) 9 | { 10 | printf("You're beat! and yet, you must allow,\n 11 | I bore my house upon my back!\n"); 12 | } 13 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/4-print_rev.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * print_rev - print s the reverse of the giben string 5 | * @s: a string 6 | * Return: void 7 | */ 8 | void print_rev(char *s) 9 | { 10 | 11 | int i; 12 | 13 | 14 | for (i = strlen(s) - 1; i >= 0; i--) 15 | { 16 | _putchar(s[i]); 17 | } 18 | _putchar('\n'); 19 | } 20 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/6-puts2.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * puts2 - prints every other character of a string 5 | * @str: a string 6 | * Return: void 7 | */ 8 | void puts2(char *str) 9 | { 10 | unsigned long int i; 11 | 12 | for (i = 0; i < strlen(str); i += 2) 13 | { 14 | _putchar(str[i]); 15 | } 16 | _putchar('\n'); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /0x0C-more_malloc_free/1-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * main - check the code 7 | * 8 | * Return: Always 0. 9 | */ 10 | int main(void) 11 | { 12 | char *concat; 13 | 14 | concat = string_nconcat("Best ", "School !!!", 6); 15 | printf("%s\n", concat); 16 | free(concat); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/1-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dog.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | struct dog my_dog; 12 | 13 | init_dog(&my_dog, "Poppy", 3.5, "Bob"); 14 | printf("My name is %s, and I am %.1f :) - Woof!\n", my_dog.name, my_dog.age); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/4-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dog.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | dog_t *my_dog; 12 | 13 | my_dog = new_dog("Poppy", 3.5, "Bob"); 14 | printf("My name is %s, and I am %.1f :) - Woof!\n", my_dog->name, my_dog->age); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031143025.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - check the code for Holberton School students. 4 | * 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | list_t *i = h; 10 | 11 | while (i! = NULL) 12 | { 13 | printf("%d - ", i -> dato); 14 | i = i -> ste; 15 | } 16 | printf("\n"); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031143136.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - check the code for Holberton School students. 4 | * 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | list_t *i = h; 10 | 11 | while (i! = NULL) 12 | { 13 | printf("%d - ", i -> len); 14 | i = i -> next; 15 | } 16 | printf("\n"); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031143232.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * main - check the code for Holberton School students. 4 | * 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | list_t *i = h; 10 | 11 | while (i! = NULL) 12 | { 13 | printf("%d - ", i -> len); 14 | i = i -> next; 15 | } 16 | printf("\n"); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031143313.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * main - check the code for Holberton School students. 4 | * 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | list_t *i = h; 10 | 11 | while (i != NULL) 12 | { 13 | printf("%d - ", i -> len); 14 | i = i -> next; 15 | } 16 | printf("\n"); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031195507.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * free_list - free all nodes and each strdup. 5 | * @head: The address of the node 6 | * Return: Nothing 7 | */ 8 | void free_list(list_t *head) 9 | { 10 | while (head->next != NULL) 11 | { 12 | free(head->str); 13 | free(head); 14 | head = head->next; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031195643.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * free_list - free all nodes and each strdup. 5 | * @head: The address of the node 6 | * Return: Nothing 7 | */ 8 | void free_list(list_t *head) 9 | { 10 | while (head->next != NULL) 11 | { 12 | free(head->str); 13 | free(head); 14 | head = head->next; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/0-putchar.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * main - Entry point 4 | * 5 | * Return: 0 Alwarys (Success) 6 | */ 7 | int main(void) 8 | { 9 | _putchar('_'); 10 | _putchar('p'); 11 | _putchar('u'); 12 | _putchar('t'); 13 | _putchar('c'); 14 | _putchar('h'); 15 | _putchar('a'); 16 | _putchar('r'); 17 | _putchar('\n'); 18 | return (0); 19 | } 20 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/2-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | 10 | int main(void) 11 | { 12 | char *s = "hello"; 13 | char *f; 14 | 15 | f = _strchr(s, 'l'); 16 | 17 | if (f != NULL) 18 | { 19 | printf("%s\n", f); 20 | } 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031144914.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | printf("[%d] %s\n", h -> len, h -> str); 13 | h = h -> next; 14 | i++; 15 | } 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/100-first_20191031192315.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | void myStartupFun(void) __attribute__ ((constructor)); 3 | /** 4 | * myStartupFun - start before main. 5 | * @void: input. 6 | * Return: text. 7 | */ 8 | void myStartupFun(void) 9 | { 10 | printf("You're beat! and yet, you must allow,\n"); 11 | printf("I bore my house upon my back!\n"); 12 | } 13 | -------------------------------------------------------------------------------- /0x1C-makefiles/100-Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | SRC = main.c school.c 3 | OBJ = $(SRC:.c=.o) 4 | NAME = school 5 | CFLAGS = -Wall -Werror -Wextra -pedantic 6 | 7 | .PHONY: all clean oclean fclean re 8 | 9 | all: m.h $(OBJ) 10 | $(CC) $(OBJ) -o $(NAME) 11 | 12 | clean: 13 | $(RM) *~ $(NAME) 14 | 15 | oclean: 16 | $(RM) $(OBJ) 17 | 18 | fclean: clean oclean 19 | 20 | re: fclean all 21 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/9-print_comb.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - Entry point 4 | * 5 | * Return: Always 0 (Success) 6 | */ 7 | int main(void) 8 | { 9 | int i; 10 | 11 | for (i = 0; i <= 9; i++) 12 | { 13 | putchar(i + '0'); 14 | if (i != 9) 15 | { 16 | putchar(','); 17 | putchar(' '); 18 | } 19 | } 20 | putchar('\n'); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/main.h: -------------------------------------------------------------------------------- 1 | int _putchar(char); 2 | void print_alphabet(void); 3 | void print_alphabet_x10(void); 4 | int _islower(int); 5 | int _isalpha(int); 6 | int print_sign(int); 7 | int _abs(int); 8 | int print_last_digit(int); 9 | void jack_bauer(void); 10 | void times_table(void); 11 | int add(int, int); 12 | void print_to_98(int n); 13 | void print_times_table(int n); 14 | -------------------------------------------------------------------------------- /0x03-debugging/1-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - causes an infinite loop 5 | * Return: 0 6 | */ 7 | 8 | int main(void) 9 | { 10 | int i; 11 | 12 | printf("Infinite loop incoming :(\n"); 13 | 14 | i = 0; 15 | 16 | /** 17 | * while (i < 10) 18 | * { 19 | * putchar(i); 20 | * } 21 | */ 22 | printf("Infinite loop avoided! \\o/\n"); 23 | return (0); 24 | } 25 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/6-print_line.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_line - print line in the terminal 5 | * @n: the number of '-' characters to be printed as a line 6 | * Return: void 7 | */ 8 | void print_line(int n) 9 | { 10 | int i; 11 | 12 | if (n > 0) 13 | for (i = 0; i < n; i++) 14 | { 15 | _putchar('_'); 16 | } 17 | _putchar('\n'); 18 | } 19 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/4-rev_array.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | *reverse_array - function that reverse 5 | *@a: pointer array. 6 | *@n: number of--- array. 7 | */ 8 | 9 | void reverse_array(int *a, int n) 10 | { 11 | int i, j; 12 | 13 | for (i = 0, j = n - 1; i < j; i++, j--) 14 | { 15 | int temp = a[i]; 16 | 17 | a[i] = a[j]; 18 | a[j] = temp; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/8-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code for 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | int array[5]; 11 | 12 | array[0] = 98; 13 | array[1] = 402; 14 | array[2] = -198; 15 | array[3] = 298; 16 | array[4] = -1024; 17 | print_array(array, 5); 18 | return (0); 19 | } 20 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/5-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char *s = "hello, world"; 12 | char *f = "world"; 13 | char *t; 14 | 15 | t = _strstr(s, f); 16 | printf("%s\n", t); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/1-dlistint_len.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lists.h" 4 | /** 5 | * dlistint_len - numer of elements 6 | * @h: head of double list 7 | * Return: Value 8 | */ 9 | size_t dlistint_len(const dlistint_t *h) 10 | { 11 | int i = 0; 12 | 13 | while (h != NULL) 14 | { 15 | i++; 16 | h = h->next; 17 | } 18 | return (i); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/4-print_most_numbers.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_most_numbers - it prints numbers form 0 to 9 5 | * 6 | * Return: the multiplication of the two numbers 7 | */ 8 | 9 | void print_most_numbers(void) 10 | { 11 | int i; 12 | 13 | for (i = 0; i <= 9; i++) 14 | if (i != 2 && i != 4) 15 | _putchar('0' + i); 16 | _putchar('\n'); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/main.h: -------------------------------------------------------------------------------- 1 | int _putchar(char c); 2 | void reset_to_98(int *n); 3 | void swap_int(int *a, int *b); 4 | int _strlen(char *s); 5 | void _puts(char *str); 6 | void print_rev(char *s); 7 | void rev_string(char *s); 8 | void puts2(char *str); 9 | void puts_half(char *str); 10 | void print_array(int *a, int n); 11 | char *_strcpy(char *dest, char *src); 12 | int _atoi(char *s); 13 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/4-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | 10 | int main(void) 11 | { 12 | char *s = "hello, world"; 13 | char *f = "world"; 14 | char *t; 15 | 16 | t = _strpbrk(s, f); 17 | printf("%s\n", t); 18 | return (0); 19 | } 20 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/1-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int a; 12 | int b; 13 | 14 | a = 98; 15 | b = 42; 16 | printf("a=%d, b=%d\n", a, b); 17 | swap_int(&a, &b); 18 | printf("a=%d, b=%d\n", a, b); 19 | return (0); 20 | } 21 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/9-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char s1[98]; 12 | char *ptr; 13 | 14 | ptr = _strcpy(s1, "First, solve the problem. Then, write the code\n"); 15 | printf("%s", s1); 16 | printf("%s", ptr); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x08-recursion/4-pow_recursion.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * _pow_recursion - prints a number raised to some number as a power 4 | * @x: the base number 5 | * @y: the power 6 | * Return: a number raised to the power 7 | */ 8 | int _pow_recursion(int x, int y) 9 | { 10 | if (y < 0) 11 | return (-1); 12 | if (y == 0) 13 | return (1); 14 | return (x * _pow_recursion(x, y - 1)); 15 | } 16 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/5-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dog.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | dog_t *my_dog; 12 | 13 | my_dog = new_dog("Poppy", 3.5, "Bob"); 14 | printf("My name is %s, and I am %.1f :) - Woof!\n", my_dog->name, my_dog->age); 15 | free_dog(my_dog); 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031195405.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * free_list - free all nodes and each strdup. 5 | * @head: The address of the node 6 | * Return: Nothing 7 | */ 8 | void free_list(list_t *head) 9 | { 10 | if (head == NULL) 11 | return; 12 | if (head->next != NULL) 13 | free_list(head->next); 14 | free(head->str); 15 | free(head); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031200001.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * free_list - free all nodes and each strdup. 5 | * @head: The address of the node 6 | * Return: Nothing 7 | */ 8 | void free_list(list_t *head) 9 | { 10 | if (head == NULL) 11 | return; 12 | if (head->next != NULL) 13 | free_list(head->next); 14 | free(head->str); 15 | free(head); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031200121.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * free_list - free all nodes and each strdup. 5 | * @head: The address of the node 6 | * Return: Nothing 7 | */ 8 | void free_list(list_t *head) 9 | { 10 | if (head == NULL) 11 | return; 12 | if (head->next != NULL) 13 | free_list(head->next); 14 | free(head->str); 15 | free(head); 16 | } 17 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/4-free_list_20191031200159.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * free_list - free all nodes and each strdup. 5 | * @head: The address of the node 6 | * Return: Nothing 7 | */ 8 | void free_list(list_t *head) 9 | { 10 | if (head == NULL) 11 | return; 12 | if (head->next != NULL) 13 | free_list(head->next); 14 | free(head->str); 15 | free(head); 16 | } 17 | -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/4-free_listint.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | #include 3 | /** 4 | * free_listint - free a linked list 5 | * @head: the start node of the linked list 6 | * Return: none 7 | */ 8 | void free_listint(listint_t *head) 9 | { 10 | listint_t *temp; 11 | 12 | while (head != NULL) 13 | { 14 | temp = head; 15 | head = head->next; 16 | free(temp); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/1-print_binary.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_binary - integer to binary. 5 | * @n: number. 6 | * Return: Output. 7 | */ 8 | 9 | void print_binary(unsigned long int n) 10 | { 11 | if (n > 1) 12 | { 13 | print_binary(n >> 1); 14 | } 15 | if (n & 1) 16 | { 17 | _putchar('1'); 18 | } 19 | else 20 | { 21 | _putchar('0'); 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/4-print_alphabt.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - Entry point 5 | * 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | int n = 97; 11 | 12 | while (n <= 122) 13 | { 14 | if (n == 113 || n == 101) 15 | { 16 | } 17 | else 18 | { 19 | putchar(n); 20 | } 21 | n++; 22 | 23 | } 24 | putchar('\n'); 25 | return (0); 26 | } 27 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/3-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char s1[] = "Hello"; 12 | char s2[] = "World!"; 13 | 14 | printf("%d\n", _strcmp(s1, s2)); 15 | printf("%d\n", _strcmp(s2, s1)); 16 | printf("%d\n", _strcmp(s1, s1)); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x0B-malloc_free/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | int _putchar(char c); 5 | char *create_array(unsigned int size, char c); 6 | char *_strdup(char *str); 7 | char *str_concat(char *s1, char *s2); 8 | int **alloc_grid(int width, int height); 9 | void free_grid(int **grid, int height); 10 | char *argstostr(int ac, char **av); 11 | char **strtow(char *str); 12 | 13 | 14 | #endif /* MAIN_H */ 15 | -------------------------------------------------------------------------------- /0x10-variadic_functions/0-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "variadic_functions.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int sum; 12 | 13 | sum = sum_them_all(2, 98, 1024); 14 | printf("%d\n", sum); 15 | sum = sum_them_all(4, 98, 1024, 402, -1024); 16 | printf("%d\n", sum); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x10-variadic_functions/variadic_functions.h: -------------------------------------------------------------------------------- 1 | #ifndef _VARIADIC_FUNCTIONS_H_ 2 | #define _VARIADIC_FUNCTIONS_H_ 3 | 4 | int sum_them_all(const unsigned int n, ...); 5 | void print_numbers(const char *separator, const unsigned int n, ...); 6 | void print_strings(const char *separator, const unsigned int n, ...); 7 | void print_all(const char * const format, ...); 8 | 9 | #endif /* _VARIADIC_FUNCTIONS_H_ */ 10 | -------------------------------------------------------------------------------- /0x1A-hash_tables/0-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hash_tables.h" 5 | 6 | /** 7 | * main - check the code for Holberton School students. 8 | * 9 | * Return: Always EXIT_SUCCESS. 10 | */ 11 | int main(void) 12 | { 13 | hash_table_t *ht; 14 | 15 | ht = hash_table_create(1024); 16 | printf("%p\n", (void *)ht); 17 | return (EXIT_SUCCESS); 18 | } 19 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/2-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | 10 | int main(void) 11 | { 12 | char *s = "hello"; 13 | char *f; 14 | 15 | f = _strchr(s, 'l'); 16 | 17 | if (f != NULL) 18 | { 19 | printf("%s\n", f); 20 | } 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/3-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dog.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | dog_t my_dog; 12 | 13 | my_dog.name = "Poppy"; 14 | my_dog.age = 3.5; 15 | my_dog.owner = "Bob"; 16 | printf("My name is %s, and I am %.1f :) - Woof!\n", my_dog.name, my_dog.age); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/0-print_dlistint.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lists.h" 4 | /** 5 | * print_dlistint - print elements for list 6 | * @h: head of list 7 | * Return: nodes 8 | */ 9 | size_t print_dlistint(const dlistint_t *h) 10 | { 11 | int i = 0; 12 | 13 | while (h) 14 | { 15 | printf("%i\n", h->n); 16 | h = h->next; 17 | i++; 18 | } 19 | return (i); 20 | } 21 | -------------------------------------------------------------------------------- /0x1C-makefiles/tests/5-main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | 5-main 4 | """ 5 | island_perimeter = __import__('5-island_perimeter').island_perimeter 6 | 7 | if __name__ == "__main__": 8 | grid = [ 9 | [0, 0, 0, 0, 0, 0], 10 | [0, 1, 0, 0, 0, 0], 11 | [0, 1, 0, 0, 0, 0], 12 | [0, 1, 1, 1, 0, 0], 13 | [0, 0, 0, 0, 0, 0] 14 | ] 15 | print(island_perimeter(grid)) 16 | -------------------------------------------------------------------------------- /0x09-static_libraries/1-strncat.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * _strncat- function that concatenates two strings. 6 | * 7 | * @dest: pointer to destination char 8 | * @src: pointer to source char 9 | * @n: number of bytes to receive 10 | * Return: char 11 | */ 12 | 13 | char *_strncat(char *dest, char *src, int n) 14 | { 15 | strncat(dest, src, n); 16 | return (dest); 17 | } 18 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/0-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dog.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | struct dog my_dog; 12 | 13 | my_dog.name = "Poppy"; 14 | my_dog.age = 3.5; 15 | my_dog.owner = "Bob"; 16 | printf("My name is %s, and I am %.1f :) - Woof!\n", my_dog.name, my_dog.age); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/1-strncat.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * _strncat- function that concatenates two strings. 6 | * 7 | * @dest: pointer to destination char 8 | * @src: pointer to source char 9 | * @n: number of bytes to receive 10 | * Return: char 11 | */ 12 | 13 | char *_strncat(char *dest, char *src, int n) 14 | { 15 | strncat(dest, src, n); 16 | return (dest); 17 | } 18 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/101-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * main - check the code 5 | * 6 | * Return: Always 0. 7 | */ 8 | int main(void) 9 | { 10 | print_number(98); 11 | _putchar('\n'); 12 | print_number(402); 13 | _putchar('\n'); 14 | print_number(1024); 15 | _putchar('\n'); 16 | print_number(0); 17 | _putchar('\n'); 18 | print_number(-98); 19 | _putchar('\n'); 20 | return (0); 21 | } 22 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/100-main.c: -------------------------------------------------------------------------------- 1 | #include "holberton.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char *s0 = "Bob Dylan"; 12 | char *s1 = "Robert Allen"; 13 | 14 | printf("%s, %s\n", s0, s1); 15 | set_string(&s1, s0); 16 | printf("%s, %s\n", s0, s1); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x09-static_libraries/1-memcpy.c: -------------------------------------------------------------------------------- 1 | /** 2 | * _memcpy - function that copies memory area 3 | * 4 | * @dest: buffer where we will copy to 5 | * @src: what we are to copy 6 | * @n: n bytes of @src 7 | * 8 | * Return: Always 0 (Success) 9 | */ 10 | 11 | char *_memcpy(char *dest, char *src, unsigned int n) 12 | { 13 | unsigned int i; 14 | 15 | for (i = 0; i < n; i++) 16 | dest[i] = src[i]; 17 | return (dest); 18 | } 19 | -------------------------------------------------------------------------------- /0x1A-hash_tables/3-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hash_tables.h" 5 | 6 | /** 7 | * main - check the code for Holberton School students. 8 | * 9 | * Return: Always EXIT_SUCCESS. 10 | */ 11 | int main(void) 12 | { 13 | hash_table_t *ht; 14 | 15 | ht = hash_table_create(1024); 16 | hash_table_set(ht, "betty", "holberton"); 17 | return (EXIT_SUCCESS); 18 | } -------------------------------------------------------------------------------- /0x02-functions_nested_loops/5-sign.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * print_sign - prints the sign of the number 4 | * @n: a number 5 | * 6 | * Return: 0,1,-1 7 | */ 8 | int print_sign(int n) 9 | { 10 | if (n > 0) 11 | { 12 | _putchar('+'); 13 | return (1); 14 | } 15 | else if (n < 0) 16 | { 17 | _putchar('-'); 18 | return (-1); 19 | } 20 | else 21 | { 22 | _putchar('0'); 23 | return (0); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/1-memcpy.c: -------------------------------------------------------------------------------- 1 | /** 2 | * _memcpy - function that copies memory area 3 | * 4 | * @dest: buffer where we will copy to 5 | * @src: what we are to copy 6 | * @n: n bytes of @src 7 | * 8 | * Return: Always 0 (Success) 9 | */ 10 | 11 | char *_memcpy(char *dest, char *src, unsigned int n) 12 | { 13 | unsigned int i; 14 | 15 | for (i = 0; i < n; i++) 16 | dest[i] = src[i]; 17 | return (dest); 18 | } 19 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/5-string_toupper.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * string_toupper - changes all lowercase letter 5 | * of a string to uppercase. 6 | *@n: cadena de caracteres. 7 | * Return: n. 8 | */ 9 | 10 | char *string_toupper(char *n) 11 | { 12 | int i; 13 | 14 | for (i = 0; n[i] != '\0'; i++) 15 | { 16 | if (n[i] >= 'a' && n[i] <= 'z') 17 | n[i] = (int)n[i] - 32; 18 | } 19 | return (n); 20 | } 21 | -------------------------------------------------------------------------------- /0x0B-malloc_free/100-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * main - check the code for ALX School students. 7 | * 8 | * Return: Always 0. 9 | */ 10 | int main(int ac, char *av[]) 11 | { 12 | char *s; 13 | 14 | s = argstostr(ac, av); 15 | if (s == NULL) 16 | { 17 | return (1); 18 | } 19 | printf("%s", s); 20 | free(s); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/main.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_FILE 2 | #define HEADER_FILE 3 | 4 | int _isupper(int c); 5 | int _isdigit(int); 6 | int mul(int, int); 7 | void print_numbers(void); 8 | int _putchar(char); 9 | void print_most_numbers(void); 10 | void more_numbers(void); 11 | void print_line(int); 12 | void print_diagonal(int); 13 | void print_square(int); 14 | void print_triangle(int); 15 | void print_number(int); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /0x15-file_io/main.h: -------------------------------------------------------------------------------- 1 | #ifndef HOLBERTON_H 2 | #define HOLBERTON_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | ssize_t read_textfile(const char *filename, size_t letters); 13 | int create_file(const char *filename, char *text_content); 14 | int append_text_to_file(const char *filename, char *text_content); 15 | #endif 16 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/2-print_alphabet_x10.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_alphabet_x10 - prints lowercase letters 10 times 5 | * 6 | * Return: void 7 | */ 8 | void print_alphabet_x10(void) 9 | { 10 | int timer; 11 | 12 | char alpha; 13 | 14 | for (timer = 0; timer < 10; timer++) 15 | { 16 | for (alpha = 'a'; alpha <= 'z'; alpha++) 17 | { 18 | _putchar(alpha); 19 | } 20 | _putchar('\n'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/7-puts_half.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * puts_half - prints half of a string 5 | * @str: a string 6 | * Return: void 7 | */ 8 | void puts_half(char *str) 9 | { 10 | int len, n, i; 11 | 12 | for (len = 0; str[len] != '\0'; len++) 13 | { 14 | } 15 | n = (len - 1) / 2; 16 | for (i = n + 1; str[i] != '\0'; i++) 17 | { 18 | _putchar(str[i]); 19 | } 20 | _putchar('\n'); 21 | } 22 | -------------------------------------------------------------------------------- /0x08-recursion/3-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int r; 12 | 13 | r = factorial(1); 14 | printf("%d\n", r); 15 | r = factorial(5); 16 | printf("%d\n", r); 17 | r = factorial(10); 18 | printf("%d\n", r); 19 | r = factorial(-1024); 20 | printf("%d\n", r); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x1A-hash_tables/1-djb2.c: -------------------------------------------------------------------------------- 1 | #include "hash_tables.h" 2 | 3 | /** 4 | * hash_djb2 - implementing djb2 algorithm 5 | * @str: evaluate key 6 | * 7 | * Return: hash key 8 | * 9 | */ 10 | unsigned long int hash_djb2(const unsigned char *str) 11 | { 12 | unsigned long int hash; 13 | int c; 14 | 15 | hash = 5381; 16 | while ((c = *str++)) 17 | { 18 | hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ 19 | } 20 | return (hash); 21 | } 22 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/101-print_number.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_number - prints an integer 5 | * @n: integer to be printed 6 | */ 7 | void print_number(int n) 8 | { 9 | unsigned int n1; 10 | 11 | if (n < 0) 12 | { 13 | n1 = -n; 14 | _putchar('-'); 15 | } else 16 | { 17 | n1 = n; 18 | } 19 | 20 | if (n1 / 10) 21 | { 22 | print_number(n1 / 10); 23 | } 24 | 25 | _putchar((n1 % 10) + '0'); 26 | } 27 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/101-print_number.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * print_number - prints an integer. 6 | * @n: input integer. 7 | * Return: no return. 8 | */ 9 | void print_number(int n) 10 | { 11 | unsigned int i; 12 | 13 | i = n; 14 | if (n < 0) 15 | { 16 | _putchar('-'); 17 | i = -n; 18 | } 19 | if (i / 10 != 0) 20 | { 21 | print_number(i / 10); 22 | } 23 | _putchar(i % 10 + '0'); 24 | } 25 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/100-main.c: -------------------------------------------------------------------------------- 1 | #include "holberton.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char *s0 = "Bob Dylan"; 12 | char *s1 = "Robert Allen"; 13 | 14 | printf("%s, %s\n", s0, s1); 15 | set_string(&s1, s0); 16 | printf("%s, %s\n", s0, s1); 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/2-get_bit.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * get_bit - bit position. 5 | * @n: number. 6 | * @index: bits. 7 | * Return: position. 8 | */ 9 | 10 | int get_bit(unsigned long int n, unsigned int index) 11 | { 12 | 13 | if (sizeof(unsigned long int) * 8 < index) 14 | { 15 | return (-1); 16 | } 17 | n >>= index; 18 | if (n & 1) 19 | { 20 | return (1); 21 | } 22 | else 23 | { 24 | return (0); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/3-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | 10 | int main(void) 11 | { 12 | char *s = "hello, world"; 13 | char *p = "helloIhello"; 14 | char *f = "oleh"; 15 | unsigned int n, z; 16 | 17 | n = _strspn(s, f); 18 | z = _strspn(p, f); 19 | printf("%u\n", n); 20 | printf("%u\n", z); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145125.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h -> str == NULL) 13 | { 14 | 15 | }else 16 | { 17 | printf("[%d] %s\n", h -> len, h -> str); 18 | h = h -> next; 19 | i++; 20 | } 21 | } 22 | return (0); 23 | } 24 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/5-flip_bits.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * flip_bits - flip of bits. 5 | * @n: one number. 6 | * @m: two number. 7 | * Return: flip bits. 8 | */ 9 | 10 | unsigned int flip_bits(unsigned long int n, unsigned long int m) 11 | { 12 | unsigned long int XOR = n ^ m; 13 | unsigned int i; 14 | 15 | for (i = 0; XOR; XOR >>= 1) 16 | { 17 | if (XOR & 1) 18 | { 19 | i++; 20 | } 21 | } 22 | 23 | return (i); 24 | } 25 | -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/6-sum_dlistint.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lists.h" 4 | /** 5 | *sum_dlistint - sum data 6 | *@head: head 7 | *Return: sum 8 | */ 9 | int sum_dlistint(dlistint_t *head) 10 | { 11 | int sum = 0; 12 | dlistint_t *temp = head; 13 | 14 | if (head == NULL) 15 | return (0); 16 | 17 | while (temp != NULL) 18 | { 19 | sum += temp->n; 20 | temp = temp->next; 21 | } 22 | return (sum); 23 | } 24 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/8-print_array.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | /** 5 | * print_array - prints n elements of an array 6 | * @n: number 7 | * @a: stiring 8 | * Return: void 9 | */ 10 | void print_array(int *a, int n) 11 | { 12 | int i; 13 | 14 | for (i = 0; i < n; i++) 15 | { 16 | if (i < n - 1) 17 | printf("%d, ", a[i]); 18 | else 19 | printf("%d", a[i]); 20 | } 21 | putchar('\n'); 22 | } 23 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/1-memcpy.c: -------------------------------------------------------------------------------- 1 | /** 2 | * _memcpy - function that copies memory area 3 | * 4 | * @dest: buffer where we will copy to 5 | * @src: what we are to copy 6 | * @n: n bytes of @src 7 | * 8 | * Return: Always 0 (Success) 9 | */ 10 | 11 | char *_memcpy(char *dest, char *src, unsigned int n) 12 | { 13 | unsigned int i; 14 | 15 | for (i = 0; i < n; i++) 16 | dest[i] = src[i]; 17 | return (dest); 18 | } 19 | -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/5-free_listint2.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | #include 3 | 4 | /** 5 | * free_listint2 - tryes to free a liked list. 6 | * @head: the startof the nodes in the linked list 7 | **/ 8 | 9 | void free_listint2(listint_t **head) 10 | { 11 | listint_t *temp; 12 | 13 | if (head == NULL) 14 | return; 15 | while (*head != NULL) 16 | { 17 | temp = (*head)->next; 18 | free(*head); 19 | *head = temp; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/3-set_bit.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * set_bit - index. 5 | * @n: number. 6 | * @index: index index. 7 | * Return: output recursion. 8 | */ 9 | 10 | int set_bit(unsigned long int *n, unsigned int index) 11 | { 12 | unsigned long int start = 1; 13 | 14 | if ((sizeof(unsigned long int) * 8) - 1 < index) 15 | { 16 | return (-1); 17 | } 18 | 19 | start <<= index; 20 | *n = *n | start; 21 | 22 | return (1); 23 | } 24 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/3-print_alphabets.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * main - Entry point 6 | * 7 | * Return: Always 0 (Success) 8 | */ 9 | 10 | int main(void) 11 | 12 | { 13 | int n = 97; 14 | 15 | int c = 65; 16 | 17 | while (n <= 122) 18 | { 19 | putchar(n); 20 | n++; 21 | } 22 | while (c <= 90) 23 | { 24 | putchar(c); 25 | c++; 26 | } 27 | 28 | putchar('\n'); 29 | 30 | return (0); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/1-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "main.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | print_binary(0); 12 | printf("\n"); 13 | print_binary(1); 14 | printf("\n"); 15 | print_binary(98); 16 | printf("\n"); 17 | print_binary(1024); 18 | printf("\n"); 19 | print_binary((1 << 10) + 1); 20 | printf("\n"); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/5-rev_string.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * rev_string - reverses the given string 5 | * @s: the string to be reversed 6 | * Return: void 7 | */ 8 | void rev_string(char *s) 9 | { 10 | char rev[500]; 11 | 12 | int i; 13 | 14 | int len; 15 | 16 | len = strlen(s) - 1; 17 | 18 | strcpy(rev, s); 19 | 20 | for (i = len; i >= 0; i--) 21 | { 22 | rev[len - i] = s[i]; 23 | } 24 | strcpy(s, rev); 25 | } 26 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/main.h: -------------------------------------------------------------------------------- 1 | char *_memset(char *s, char b, unsigned int n); 2 | char *_memcpy(char *dest, char *src, unsigned int n); 3 | char *_strchr(char *s, char c); 4 | unsigned int _strspn(char *s, char *accept); 5 | char *_strpbrk(char *s, char *accept); 6 | char *_strstr(char *haystack, char *needle); 7 | void print_chessboard(char (*a)[8]); 8 | int _putchar(char c); 9 | void print_diagsums(int *a, int size); 10 | void set_string(char **s, char *to); 11 | -------------------------------------------------------------------------------- /0x0A-argc_argv/3-mul.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | /** 4 | * main - the main entry 5 | * @argc: number of arguments passed 6 | * @argv: the array of arguments 7 | * Return: 0 if success and 1 if error 8 | */ 9 | int main(int argc, char *argv[]) 10 | { 11 | if (argc != 3) 12 | { 13 | printf("%s\n", "Error"); 14 | return (1); 15 | } 16 | else 17 | { 18 | printf("%d\n", atoi(argv[1]) * atoi(argv[2])); 19 | return (0); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /0x0B-malloc_free/2-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * main - check the code for ALX School students. 7 | * 8 | * Return: Always 0. 9 | */ 10 | int main(void) 11 | { 12 | char *s; 13 | 14 | s = str_concat("Betty ", "Holberton"); 15 | if (s == NULL) 16 | { 17 | printf("failed\n"); 18 | return (1); 19 | } 20 | printf("%s\n", s); 21 | free(s); 22 | return (0); 23 | } 24 | -------------------------------------------------------------------------------- /0x0B-malloc_free/1-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * main - check the code for ALX School students. 7 | * 8 | * Return: Always 0. 9 | */ 10 | int main(void) 11 | { 12 | char *s; 13 | 14 | s = _strdup("ALX SE"); 15 | if (s == NULL) 16 | { 17 | printf("failed to allocate memory\n"); 18 | return (1); 19 | } 20 | printf("%s\n", s); 21 | free(s); 22 | return (0); 23 | } 24 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/4-clear_bit.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * clear_bit - clear a bit to zero. 5 | * @n: number. 6 | * @index: move position change. 7 | * Return: 1 if all ok. 8 | */ 9 | 10 | int clear_bit(unsigned long int *n, unsigned int index) 11 | { 12 | unsigned long int start = 1; 13 | 14 | if ((sizeof(unsigned long int) * 8) - 1 < index) 15 | { 16 | return (-1); 17 | } 18 | start <<= index; 19 | *n &= ~start; 20 | 21 | return (1); 22 | } 23 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/0-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char s1[98] = "Hello "; 12 | char s2[] = "World!\n"; 13 | char *ptr; 14 | 15 | printf("%s\n", s1); 16 | printf("%s", s2); 17 | ptr = _strcat(s1, s2); 18 | printf("%s", s1); 19 | printf("%s", s2); 20 | printf("%s", ptr); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/5-more_numbers.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * more_numbers - print numbers 10 times 5 | * 6 | * Return: void 7 | */ 8 | void more_numbers(void) 9 | { 10 | int count, i; 11 | 12 | count = 0; 13 | for (count = 0; count < 10; count++) 14 | { 15 | for (i = 0; i <= 14; i++) 16 | { 17 | if (i > 9) 18 | { 19 | _putchar((i / 10) + '0'); 20 | } 21 | _putchar((i % 10) + '0'); 22 | } 23 | _putchar('\n'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/main.h: -------------------------------------------------------------------------------- 1 | int _putchar(char c); 2 | char *_strcat(char *dest, char *src); 3 | char *_strncat(char *dest, char *src, int n); 4 | char *_strncpy(char *dest, char *src, int n); 5 | int _strcmp(char *s1, char *s2); 6 | void reverse_array(int *a, int n); 7 | char *string_toupper(char *); 8 | char *cap_string(char *); 9 | char *leet(char *); 10 | char *rot13(char *); 11 | void print_number(int n); 12 | char *infinite_add(char *n1, char *n2, char *r, int size_r); 13 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/3-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code for ALX School students. 6 | * 7 | * Return: Always 0. 8 | */ 9 | 10 | int main(void) 11 | { 12 | char *s = "hello, world"; 13 | char *p = "helloIhello"; 14 | char *f = "oleh"; 15 | unsigned int n, z; 16 | 17 | n = _strspn(s, f); 18 | z = _strspn(p, f); 19 | printf("%u\n", n); 20 | printf("%u\n", z); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/1-init_dog.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dog.h" 3 | /** 4 | * init_dog - intialization of the dog structure 5 | * @d: a dog structure 6 | * @name: the name of the dog 7 | * @age: the age of the dog 8 | * @owner: the owner ogf the dog 9 | * Return: void 10 | */ 11 | void init_dog(struct dog *d, char *name, float age, char *owner) 12 | { 13 | if (d != NULL) 14 | { 15 | d->name = name; 16 | d->age = age; 17 | d->owner = owner; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145905.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h->str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h->next; 16 | } else 17 | { 18 | printf("[%d] %s\n", h->len, h->str); 19 | h = h->next; 20 | }i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145916.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h->str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h->next; 16 | } else 17 | { 18 | printf("[%d] %s\n", h->len, h->str); 19 | h = h->next; 20 | } i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031150151.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Element. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h->str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h->next; 16 | } else 17 | { 18 | printf("[%d] %s\n", h->len, h->str); 19 | h = h->next; 20 | } i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031150219.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Element. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h->str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h->next; 16 | } else 17 | { 18 | printf("[%d] %s\n", h->len, h->str); 19 | h = h->next; 20 | } i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031150222.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Element. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h->str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h->next; 16 | } else 17 | { 18 | printf("[%d] %s\n", h->len, h->str); 19 | h = h->next; 20 | } i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031150323.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Element. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h->str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h->next; 16 | } else 17 | { 18 | printf("[%d] %s\n", h->len, h->str); 19 | h = h->next; 20 | } i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/8-print_square.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | /** 3 | * print_square - print a square of # characters 4 | * @size: the size fo the square 5 | * Return: void 6 | */ 7 | void print_square(int size) 8 | { 9 | int length, width; 10 | 11 | if (size <= 0) 12 | _putchar('\n'); 13 | 14 | for (length = 0; length < size; length++) 15 | { 16 | for (width = 0; width < size; width++) 17 | { 18 | _putchar('#'); 19 | } 20 | _putchar('\n'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /0x08-recursion/100-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int r; 12 | 13 | r = is_palindrome("level"); 14 | printf("%d\n", r); 15 | r = is_palindrome("redder"); 16 | printf("%d\n", r); 17 | r = is_palindrome("test"); 18 | printf("%d\n", r); 19 | r = is_palindrome("step on no pets"); 20 | printf("%d\n", r); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145544.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h -> str == NULL) 13 | { 14 | printf("[0] (nil)"); 15 | h = h -> next; 16 | }else 17 | { 18 | printf("[%d] %s\n", h -> len, h -> str); 19 | h = h -> next; 20 | }i++; 21 | } 22 | return (0); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145559.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h -> str == NULL) 13 | { 14 | printf("[0] (nil)"); 15 | h = h -> next; 16 | }else 17 | { 18 | printf("[%d] %s\n", h -> len, h -> str); 19 | h = h -> next; 20 | }i++; 21 | } 22 | return (0); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145620.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h -> str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h -> next; 16 | }else 17 | { 18 | printf("[%d] %s\n", h -> len, h -> str); 19 | h = h -> next; 20 | }i++; 21 | } 22 | return (0); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145649.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h -> str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h -> next; 16 | }else 17 | { 18 | printf("[%d] %s\n", h -> len, h -> str); 19 | h = h -> next; 20 | }i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x15-file_io/1-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "main.h" 4 | 5 | /** 6 | * main - check the code for Holberton School students. 7 | * 8 | * Return: Always 0. 9 | */ 10 | int main(int ac, char **av) 11 | { 12 | int res; 13 | 14 | if (ac != 3) 15 | { 16 | dprintf(2, "Usage: %s filename text\n", av[0]); 17 | exit(1); 18 | } 19 | res = create_file(av[1], av[2]); 20 | printf("-> %i)\n", res); 21 | return (0); 22 | } 23 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/main.h: -------------------------------------------------------------------------------- 1 | char *_memset(char *s, char b, unsigned int n); 2 | char *_memcpy(char *dest, char *src, unsigned int n); 3 | char *_strchr(char *s, char c); 4 | unsigned int _strspn(char *s, char *accept); 5 | char *_strpbrk(char *s, char *accept); 6 | char *_strstr(char *haystack, char *needle); 7 | void print_chessboard(char (*a)[8]); 8 | int _putchar(char c); 9 | void print_diagsums(int *a, int size); 10 | void set_string(char **s, char *to); 11 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145711.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h -> str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h -> next; 16 | }else 17 | { 18 | printf("[%d] %s\n", h -> len, h -> str); 19 | h = h -> next; 20 | }i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031145834.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Always 0. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h->str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h -> next; 16 | }else 17 | { 18 | printf("[%d] %s\n", h -> len, h -> str); 19 | h = h -> next; 20 | }i++; 21 | } 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031150738.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * print_list - print elements of list. 4 | * @h: input. 5 | * Return: Element. 6 | */ 7 | size_t print_list(const list_t *h) 8 | { 9 | int i = 0; 10 | while (h != NULL) 11 | { 12 | if (h->str == NULL) 13 | { 14 | printf("[0] (nil)\n"); 15 | h = h->next; 16 | } 17 | else 18 | { 19 | printf("[%d] %s\n", h->len, h->str); 20 | h = h->next; 21 | } i++; 22 | } 23 | return (i); 24 | } 25 | -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/1-listint_len.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * listint_len - prints the integer in the linked list 4 | * @h: a pointer to a linked list 5 | * Return: size_t 6 | */ 7 | size_t listint_len(const listint_t *h) 8 | { 9 | size_t count; 10 | 11 | if (h == NULL) 12 | return (0); 13 | count = 0; 14 | do { 15 | if (h == NULL) 16 | ; 17 | else 18 | { 19 | count++; 20 | h = h->next; 21 | } 22 | } while (h != NULL); 23 | return (count); 24 | } 25 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/0-positive_or_negative.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /** 6 | * main - Entry point 7 | * 8 | * Return: Always 0 (Success) 9 | */ 10 | int main(void) 11 | { 12 | int n; 13 | 14 | srand(time(0)); 15 | 16 | n = rand() - RAND_MAX / 2; 17 | 18 | if (n > 0) 19 | printf("%d is positive\n", n); 20 | else if (n < 0) 21 | printf("%d is negative\n", n); 22 | else 23 | printf("%d is zero\n", n); 24 | return (0); 25 | } 26 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/7-print_diagonal.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_diagonal - prints backward slacsha as a diagonal 5 | * @n: the number of times the backward slash is printed 6 | * Return: void 7 | */ 8 | void print_diagonal(int n) 9 | { 10 | int i, j; 11 | 12 | if (n <= 0) 13 | _putchar('\n'); 14 | for (i = 0; i < n; i++) 15 | { 16 | for (j = 0; j < i; j++) 17 | { 18 | _putchar(' '); 19 | } 20 | _putchar('\\'); 21 | _putchar('\n'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/0-print_list.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print list. 5 | * @h: list. 6 | * Return: The elements linked. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | 12 | while (h != NULL) 13 | { 14 | if (h->str == NULL) 15 | { 16 | printf("[0] (nil)\n"); 17 | h = h->next; 18 | } 19 | else 20 | { 21 | printf("[%d] %s\n", h->len, h->str); 22 | h = h->next; 23 | } 24 | i++; 25 | } 26 | return (i); 27 | } 28 | -------------------------------------------------------------------------------- /0x09-static_libraries/100-atoi.c: -------------------------------------------------------------------------------- 1 | /** 2 | * _atoi - converts a string to an integer 3 | * 4 | * @s: string input parameter 5 | * 6 | * Return: converted integer from string 7 | */ 8 | 9 | int _atoi(char *s) 10 | { 11 | unsigned int num = 0; 12 | int sign = 1; 13 | 14 | do { 15 | if (*s == '-') 16 | sign *= -1; 17 | else if (*s >= '0' && *s <= '9') 18 | num = (num * 10) + (*s - '0'); 19 | else if (num > 0) 20 | break; 21 | } while (*s++); 22 | 23 | return (num * sign); 24 | } 25 | -------------------------------------------------------------------------------- /0x15-file_io/2-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "main.h" 4 | 5 | /** 6 | * main - check the code for Holberton School students. 7 | * 8 | * Return: Always 0. 9 | */ 10 | int main(int ac, char **av) 11 | { 12 | int res; 13 | 14 | if (ac != 3) 15 | { 16 | dprintf(2, "Usage: %s filename text\n", av[0]); 17 | exit(1); 18 | } 19 | res = append_text_to_file(av[1], av[2]); 20 | printf("-> %i)\n", res); 21 | return (0); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /0x00-hello_world/6-size.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | *main - Entry point 5 | * 6 | *Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | printf("Size of a char: %d byte(s)\n", sizeof(char)); 11 | printf("Size of an int: %d%s\n", sizeof(int), " byte(s)"); 12 | printf("Size of a long int: %d byte(s)\n", sizeof(long int)); 13 | printf("Size of a long long int: %d byte(s)\n", sizeof(long long int)); 14 | printf("Size of a float: %d%s\n", sizeof(float), " byte(s)"); 15 | return (0); 16 | } 17 | -------------------------------------------------------------------------------- /0x05-pointers_arrays_strings/100-atoi.c: -------------------------------------------------------------------------------- 1 | /** 2 | * _atoi - converts a string to an integer 3 | * 4 | * @s: string input parameter 5 | * 6 | * Return: converted integer from string 7 | */ 8 | 9 | int _atoi(char *s) 10 | { 11 | unsigned int num = 0; 12 | int sign = 1; 13 | 14 | do { 15 | if (*s == '-') 16 | sign *= -1; 17 | else if (*s >= '0' && *s <= '9') 18 | num = (num * 10) + (*s - '0'); 19 | else if (num > 0) 20 | break; 21 | } while (*s++); 22 | 23 | return (num * sign); 24 | } 25 | -------------------------------------------------------------------------------- /0x0F-function_pointers/3-calc.h: -------------------------------------------------------------------------------- 1 | #ifndef _CALC_H_ 2 | #define _CALC_H_ 3 | 4 | /** 5 | * struct op - Struct op 6 | * 7 | * @op: The operator 8 | * @f: The function associated 9 | */ 10 | typedef struct op 11 | { 12 | char *op; 13 | int (*f)(int a, int b); 14 | } op_t; 15 | 16 | int op_add(int a, int b); 17 | int op_sub(int a, int b); 18 | int op_mul(int a, int b); 19 | int op_div(int a, int b); 20 | int op_mod(int a, int b); 21 | int (*get_op_func(char *s))(int, int); 22 | 23 | #endif /* _CALC_H_ */ 24 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031151428.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print elements of list. 5 | * @h: input. 6 | * Return: Element. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | while (h != NULL) 12 | { 13 | if (h->str == NULL) 14 | { 15 | printf("[0] (nil)\n"); 16 | h = h->next; 17 | } 18 | else 19 | { 20 | printf("[%d] %s\n", h->len, h->str); 21 | h = h->next; 22 | } i++; 23 | } 24 | return (i); 25 | } 26 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031151521.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print elements of list. 5 | * @h: input. 6 | * Return: Element. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | while (h != NULL) 12 | { 13 | if (h->str == NULL) 14 | { 15 | printf("[0] (nil)\n"); 16 | h = h->next; 17 | } 18 | else 19 | { 20 | printf("[%d] %s\n", h->len, h->str); 21 | h = h->next; 22 | } i++; 23 | } 24 | return (i); 25 | } 26 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/7-print_last_digit.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_last_digit - Pprints the last digit of the digit 5 | * @n: the number 6 | * 7 | * Return: he value of ithe last digit 8 | */ 9 | int print_last_digit(int n) 10 | { 11 | int last_digit; 12 | 13 | last_digit = n % 10; 14 | if (last_digit < 0) 15 | { 16 | _putchar('0' + -last_digit); 17 | return (-last_digit); 18 | } 19 | else 20 | { 21 | _putchar('0' + last_digit); 22 | return (last_digit); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/7-print_chessboard.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_chessboard - prints the chess board 5 | * 6 | * @a: input pointer 7 | * 8 | * Return: return nothing 9 | */ 10 | 11 | void print_chessboard(char (*a)[8]) 12 | { 13 | int i, j; 14 | 15 | i = 0; 16 | j = 0; 17 | while (i < 64) 18 | { 19 | if (i % 8 == 0 && i != 0) 20 | { 21 | j = i; 22 | _putchar('\n'); 23 | } 24 | 25 | _putchar(a[i / 8][i - j]); 26 | i++; 27 | } 28 | _putchar('\n'); 29 | } 30 | -------------------------------------------------------------------------------- /0x0F-function_pointers/1-array_iterator.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "function_pointers.h" 3 | /** 4 | * array_iterator - prints the elements in the array 5 | * @array: an array 6 | * @size: the size of the array 7 | * @action: a function 8 | * Return: void 9 | */ 10 | void array_iterator(int *array, size_t size, void (*action)(int)) 11 | { 12 | if (array != NULL && action != NULL) 13 | { 14 | size_t i; 15 | 16 | for (i = 0; i < size; i++) 17 | { 18 | action(array[i]); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031151815.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print elements of list. 5 | * @h: input. 6 | * Return: Element. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | while (h != NULL) 12 | { 13 | if (h->str == NULL) 14 | { 15 | printf("[0] (nil)\n"); 16 | h = h->next; 17 | } 18 | else 19 | { 20 | printf("[%d] %s\n", h->len, h->str); 21 | h = h->next; 22 | } 23 | i++; 24 | } 25 | return (i); 26 | } 27 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031151956.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print elements of list. 5 | * @h: input. 6 | * Return: Element. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | while (h != NULL) 12 | { 13 | if (h->str == NULL) 14 | { 15 | printf("[0] (nil)\n"); 16 | h = h->next; 17 | } 18 | else 19 | { 20 | printf("[%d] %s\n", h->len, h->str); 21 | h = h->next; 22 | } 23 | i++; 24 | } 25 | return (i); 26 | } 27 | -------------------------------------------------------------------------------- /0x17-doubly_linked_lists/4-free_dlistint.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lists.h" 4 | /** 5 | *free_dlistint - free memory 6 | *@head: head list 7 | *Return: void 8 | */ 9 | void free_dlistint(dlistint_t *head) 10 | { 11 | dlistint_t *freememory; 12 | 13 | if (head == NULL) 14 | return; 15 | 16 | freememory = head->next; 17 | 18 | while (freememory != NULL) 19 | { 20 | free(head); 21 | head = freememory; 22 | freememory = freememory->next; 23 | } 24 | free(head); 25 | } 26 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/8-24_hours.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | *jack_bauer - prints every minute of the day of Jack Bauer 5 | * 6 | * Return: void 7 | */ 8 | void jack_bauer(void) 9 | { 10 | 11 | int i, j; 12 | 13 | i = 0; 14 | for (; i < 24 ; i++) 15 | { 16 | j = 0; 17 | for (; j < 60 ; j++) 18 | { 19 | _putchar((i / 10) + '0'); 20 | _putchar((i % 10) + '0'); 21 | _putchar(':'); 22 | _putchar((j / 10) + '0'); 23 | _putchar((j % 10) + '0'); 24 | _putchar('\n'); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031152805.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print list. 5 | * @h: list. 6 | * Return: The elements linked. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | 12 | while (h != NULL) 13 | { 14 | if (h->str == NULL) 15 | { 16 | printf("[0] (nil)\n"); 17 | h = h->next; 18 | } 19 | else 20 | { 21 | printf("[%d] %s\n", h->len, h->str); 22 | h = h->next; 23 | } 24 | i++; 25 | } 26 | return (i); 27 | } 28 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191105123438.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print list. 5 | * @h: list. 6 | * Return: The elements linked. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | 12 | while (h != NULL) 13 | { 14 | if (h->str == NULL) 15 | { 16 | printf("[0] (nil)\n"); 17 | h = h->next; 18 | } 19 | else 20 | { 21 | printf("[%d] %s\n", h->len, h->str); 22 | h = h->next; 23 | } 24 | i++; 25 | } 26 | return (i); 27 | } 28 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/11-print_to_98.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "main.h" 3 | 4 | /** 5 | *print_to_98 - prints all natural numbers from n to 98 6 | * @n: input number to check 7 | * Return: nothing. 8 | */ 9 | 10 | void print_to_98(int n) 11 | { 12 | if (n < 98) 13 | { 14 | for (; n < 98; n++) 15 | { 16 | printf("%d, ", n); 17 | } 18 | } 19 | else if (n > 98) 20 | { 21 | for (; n > 98; n--) 22 | { 23 | printf("%d, ", n); 24 | } 25 | } 26 | if (n == 98) 27 | { 28 | printf("%d\n", n); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191105123104.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print list. 5 | * @h: list. 6 | * Return: The elements linked. 7 | */ 8 | size_t print_listint(const listint_t *h) 9 | { 10 | int i = 0; 11 | 12 | while (h != NULL) 13 | { 14 | if (h->str == NULL) 15 | { 16 | printf("[0] (nil)\n"); 17 | h = h->next; 18 | } 19 | else 20 | { 21 | printf("[%d] %s\n", h->len, h->str); 22 | h = h->next; 23 | } 24 | i++; 25 | } 26 | return (i); 27 | } 28 | -------------------------------------------------------------------------------- /0x1A-hash_tables/2-key_index.c: -------------------------------------------------------------------------------- 1 | #include "hash_tables.h" 2 | 3 | /** 4 | * key_index - index of a key 5 | * @key: key 6 | * @size: array for hash table 7 | * 8 | * Return: index with key storage in array 9 | * 10 | */ 11 | unsigned long int key_index(const unsigned char *key, unsigned long int size) 12 | { 13 | unsigned long int hash; 14 | unsigned long int index; 15 | 16 | if (key == NULL || size == 0) 17 | return (0); 18 | 19 | hash = hash_djb2(key); 20 | index = hash % size; 21 | 22 | return (index); 23 | } 24 | -------------------------------------------------------------------------------- /0x0B-malloc_free/1-strdup.c: -------------------------------------------------------------------------------- 1 | #include"main.h" 2 | #include 3 | #include 4 | /** 5 | *_strdup - the string given as a parameter. 6 | *@str: - string 7 | *Return: - string 8 | */ 9 | char *_strdup(char *str) 10 | { 11 | char *dest, *toReturn; 12 | 13 | if (str == NULL) 14 | return (NULL); 15 | dest = malloc((1 + strlen(str)) * sizeof(char)); 16 | toReturn = dest; 17 | if (toReturn == NULL) 18 | return (NULL); 19 | while (*str) 20 | { 21 | *dest++ = *str++; 22 | } 23 | return (toReturn); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /0x07-pointers_arrays_strings/0x07-pointers_arrays_strings/7-print_chessboard.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_chessboard - prints the chess board 5 | * 6 | * @a: input pointer 7 | * 8 | * Return: return nothing 9 | */ 10 | 11 | void print_chessboard(char (*a)[8]) 12 | { 13 | int i, j; 14 | 15 | i = 0; 16 | j = 0; 17 | while (i < 64) 18 | { 19 | if (i % 8 == 0 && i != 0) 20 | { 21 | j = i; 22 | _putchar('\n'); 23 | } 24 | 25 | _putchar(a[i / 8][i - j]); 26 | i++; 27 | } 28 | _putchar('\n'); 29 | } 30 | -------------------------------------------------------------------------------- /0x09-static_libraries/0-isupper.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * _isupper - cheks if the character is lowercase 5 | * @c: the charater to be determined if it is lower or not 6 | * Return: 1 if losercase or 0 if not 7 | */ 8 | int _isupper(int c) 9 | { 10 | int alpha; 11 | 12 | int count; 13 | 14 | count = 0; 15 | 16 | for (alpha = 65; alpha <= 90; alpha++) 17 | { 18 | if (c == alpha) 19 | { 20 | count++; 21 | break; 22 | } 23 | } 24 | if (count == 0) 25 | return (0); 26 | else 27 | return (1); 28 | } 29 | -------------------------------------------------------------------------------- /0x09-static_libraries/3-islower.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * _islower - cheks if the character is lowercase 5 | * @c: the charater to be determined if it is lower or not 6 | * Return: 1 if losercase or 0 if not 7 | */ 8 | int _islower(int c) 9 | { 10 | int alpha; 11 | 12 | int count; 13 | 14 | count = 0; 15 | 16 | for (alpha = 97; alpha <= 122; alpha++) 17 | { 18 | if (c == alpha) 19 | { 20 | count++; 21 | break; 22 | } 23 | } 24 | if (count == 0) 25 | return (0); 26 | else 27 | return (1); 28 | } 29 | -------------------------------------------------------------------------------- /0x01-variables_if_else_while/100-print_comb3.c: -------------------------------------------------------------------------------- 1 | #include 2 | /** 3 | * main - Entry point 4 | * 5 | * Return: Always 0 (Success) 6 | */ 7 | int main(void) 8 | { 9 | int i; 10 | 11 | int j; 12 | 13 | for (i = 0; i <= 8; i++) 14 | { 15 | for (j = 1; j <= 9; j++) 16 | { 17 | if (i < j) 18 | { 19 | putchar(i + '0'); 20 | putchar(j + '0'); 21 | if (i != 8 || j != 9) 22 | { 23 | putchar(','); 24 | putchar(' '); 25 | } 26 | } 27 | } 28 | } 29 | putchar('\n'); 30 | return (0); 31 | } 32 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/3-islower.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * _islower - cheks if the character is lowercase 5 | * @c: the charater to be determined if it is lower or not 6 | * Return: 1 if losercase or 0 if not 7 | */ 8 | int _islower(int c) 9 | { 10 | int alpha; 11 | 12 | int count; 13 | 14 | count = 0; 15 | 16 | for (alpha = 97; alpha <= 122; alpha++) 17 | { 18 | if (c == alpha) 19 | { 20 | count++; 21 | break; 22 | } 23 | } 24 | if (count == 0) 25 | return (0); 26 | else 27 | return (1); 28 | } 29 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/0-isupper.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * _isupper - cheks if the character is lowercase 5 | * @c: the charater to be determined if it is lower or not 6 | * Return: 1 if losercase or 0 if not 7 | */ 8 | int _isupper(int c) 9 | { 10 | int alpha; 11 | 12 | int count; 13 | 14 | count = 0; 15 | 16 | for (alpha = 65; alpha <= 90; alpha++) 17 | { 18 | if (c == alpha) 19 | { 20 | count++; 21 | break; 22 | } 23 | } 24 | if (count == 0) 25 | return (0); 26 | else 27 | return (1); 28 | } 29 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/main.h: -------------------------------------------------------------------------------- 1 | #ifndef BYTES_H 2 | #define BYTES_H 3 | 4 | #include 5 | #include 6 | #include 7 | unsigned int binary_to_uint(const char *b); 8 | void print_binary(unsigned long int n); 9 | int get_bit(unsigned long int n, unsigned int index); 10 | int set_bit(unsigned long int *n, unsigned int index); 11 | int clear_bit(unsigned long int *n, unsigned int index); 12 | unsigned int flip_bits(unsigned long int n, unsigned long int m); 13 | int get_endianness(void); 14 | int _putchar(char c); 15 | #endif 16 | -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/0-print_listint.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | #include 3 | /** 4 | * print_listint - prints the integer in the linked list 5 | * @h: a pointer to a linked list 6 | * Return: size_t 7 | */ 8 | size_t print_listint(const listint_t *h) 9 | { 10 | size_t count; 11 | 12 | if (h == NULL) 13 | return (0); 14 | count = 0; 15 | do { 16 | if (h == NULL) 17 | ; 18 | else 19 | { 20 | printf("%d\n", h->n); 21 | count++; 22 | h = h->next; 23 | } 24 | } while (h != NULL); 25 | return (count); 26 | } 27 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/2-print_dog.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "dog.h" 3 | /** 4 | * print_dog - prints the elemnts in the structre 5 | * @d: a pointer to a structure 6 | * Return: void 7 | */ 8 | void print_dog(struct dog *d) 9 | { 10 | if (d != NULL) 11 | { 12 | if (d->name == NULL) 13 | printf("Name: (nil)\n"); 14 | else 15 | printf("Name: %s\n", d->name); 16 | 17 | printf("Age: %f\n", d->age); 18 | 19 | if (d->owner == NULL) 20 | printf("Owner: (nil)\n"); 21 | else 22 | printf("Owner: %s\n", d->owner); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /0x04-more_functions_nested_loops/10-print_triangle.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * print_triangle - print trialgles usin '#' 5 | * @size: the size of the trangle 6 | * Return: ivoid 7 | */ 8 | void print_triangle(int size) 9 | { 10 | int i; 11 | int j; 12 | int k; 13 | 14 | for (i = 0; i < size; i++) 15 | { 16 | for (k = size - 1 - i; k > 0; k--) 17 | { 18 | _putchar(' '); 19 | } 20 | for (j = 0; j <= i; j++) 21 | { 22 | _putchar('#'); 23 | } 24 | _putchar('\n'); 25 | } 26 | if (size <= 0) 27 | { 28 | _putchar('\n'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031152410.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print each element of a list. 5 | * @h: My pointer to list. 6 | * Return: The elements that are linked. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | 12 | while (h != NULL) 13 | { 14 | if (h->str == NULL) 15 | { 16 | printf("[0] (nil)\n"); 17 | h = h->next; 18 | } 19 | else 20 | { 21 | printf("[%d] %s\n", h->len, h->str); 22 | h = h->next; 23 | } 24 | i++; 25 | } 26 | return (i); 27 | } 28 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191105122844.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | #include 3 | #include 4 | /** 5 | * print_list - print list. 6 | * @h: list. 7 | * Return: The elements linked. 8 | */ 9 | size_t print_list(const list_t *h) 10 | { 11 | int i = 0; 12 | 13 | while (h != NULL) 14 | { 15 | if (h->str == NULL) 16 | { 17 | printf("[0] (nil)\n"); 18 | h = h->next; 19 | } 20 | else 21 | { 22 | printf("[%d] %s\n", h->len, h->str); 23 | h = h->next; 24 | } 25 | i++; 26 | } 27 | return (i); 28 | } 29 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/102-magic.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | int n; 6 | int a[5]; 7 | int *p; 8 | 9 | a[2] = 1024; 10 | p = &n; 11 | /* 12 | * write your line of code here... 13 | * Remember: 14 | * - you are not allowed to use a 15 | * - you are not allowed to modify p 16 | * - only one statement 17 | * - you are not allowed to code anything else than this line of code 18 | */ 19 | *(p + 5) = 98; 20 | /* ...so that this prints 98\n */ 21 | printf("a[2] = %d\n", a[2]); 22 | return (0); 23 | } 24 | -------------------------------------------------------------------------------- /0x13-more_singly_linked_lists/8-sum_listint.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | /** 3 | * sum_listint - returns the sum of the elements in the node 4 | * @head: the starting nod e of the list 5 | * Return: the sum of the vlues in the list 6 | */ 7 | int sum_listint(listint_t *head) 8 | { 9 | int sum = 0; 10 | listint_t *temp; 11 | 12 | if (head == NULL) 13 | return (0); 14 | temp = head; 15 | do { 16 | if (temp == NULL) 17 | ; 18 | else 19 | { 20 | sum += temp->n; 21 | temp = temp->next; 22 | } 23 | } while (temp != NULL); 24 | return (sum); 25 | } 26 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/102-fibonacci.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - prints the first 50 Fibonacci numbers, starting with 1 and 2 5 | * followed by a new line 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | long int i, j, k, next; 11 | 12 | j = 1; 13 | 14 | k = 2; 15 | 16 | for (i = 1; i <= 50; ++i) 17 | { 18 | if (j != 20365011074) 19 | { 20 | printf("%ld, ", j); 21 | } else 22 | { 23 | printf("%ld\n", j); 24 | } 25 | next = j + k; 26 | j = k; 27 | k = next; 28 | } 29 | 30 | return (0); 31 | } 32 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/0-print_list_20191031152257.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * print_list - print each element of a list. 5 | * @h: My pointer to list (structure). 6 | * Return: The elemts that are linked. 7 | */ 8 | size_t print_list(const list_t *h) 9 | { 10 | int i = 0; 11 | 12 | while (h != NULL) 13 | { 14 | if (h->str == NULL) 15 | { 16 | printf("[0] (nil)\n"); 17 | h = h->next; 18 | } 19 | else 20 | { 21 | printf("[%d] %s\n", h->len, h->str); 22 | h = h->next; 23 | } 24 | i++; 25 | } 26 | return (i); 27 | } 28 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/7-leet.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * leet - encodes a string into 1337. 6 | * @s: string to code 7 | * Return: the enconde string. 8 | */ 9 | char *leet(char *s) 10 | { 11 | unsigned long int i, j; 12 | char alp[5] = { 'A', 'E', 'O', 'T', 'L' }; 13 | char num[5] = { '4', '3', '0', '7', '1' }; 14 | 15 | for (i = 0; s[i] != '\0'; i++) 16 | { 17 | j = 0; 18 | for (; j < strlen(num); j++) 19 | { 20 | if (s[i] == alp[j] || s[i] - 32 == alp[j]) 21 | s[i] = num[j]; 22 | } 23 | } 24 | return (s); 25 | } 26 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/103-fibonacci.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - finds and prints the sum of the even-valued terms 5 | * followed by a new line 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | int i; 11 | unsigned long int j, k, next, sum; 12 | 13 | j = 1; 14 | k = 2; 15 | sum = 0; 16 | 17 | for (i = 1; i <= 33; ++i) 18 | { 19 | if (j < 4000000 && (j % 2) == 0) 20 | { 21 | sum = sum + j; 22 | } 23 | next = j + k; 24 | j = k; 25 | k = next; 26 | } 27 | 28 | printf("%lu\n", sum); 29 | 30 | return (0); 31 | } 32 | -------------------------------------------------------------------------------- /0x03-debugging/2-largest_number.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | /** 4 | * largest_number - returns the largest of 3 numbers 5 | * @a: first integer 6 | * @b: second integer 7 | * @c: third integer 8 | * Return: largest number 9 | */ 10 | 11 | int largest_number(int a, int b, int c) 12 | { 13 | int largest; 14 | 15 | if (a > b && a > c) 16 | { 17 | largest = a; 18 | } 19 | else if (a > b && c > a) 20 | { 21 | largest = c; 22 | } 23 | else if (b > c) 24 | { 25 | largest = b; 26 | } 27 | else 28 | { 29 | largest = c; 30 | } 31 | 32 | return (largest); 33 | } 34 | -------------------------------------------------------------------------------- /0x14-bit_manipulation/0-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "main.h" 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | unsigned int n; 12 | 13 | n = binary_to_uint("1"); 14 | printf("%u\n", n); 15 | n = binary_to_uint("101"); 16 | printf("%u\n", n); 17 | n = binary_to_uint("1e01"); 18 | printf("%u\n", n); 19 | n = binary_to_uint("1100010"); 20 | printf("%u\n", n); 21 | n = binary_to_uint("0000000000000000000110010010"); 22 | printf("%u\n", n); 23 | return (0); 24 | } 25 | -------------------------------------------------------------------------------- /0x1A-hash_tables/1-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hash_tables.h" 5 | 6 | /** 7 | * main - check the code for Holberton School students. 8 | * 9 | * Return: Always EXIT_SUCCESS. 10 | */ 11 | int main(void) 12 | { 13 | char *s; 14 | 15 | s = "cisfun"; 16 | printf("%lu\n", hash_djb2((unsigned char *)s)); 17 | s = "Don't forget to tweet today"; 18 | printf("%lu\n", hash_djb2((unsigned char *)s)); 19 | s = "98"; 20 | printf("%lu\n", hash_djb2((unsigned char *)s)); 21 | return (EXIT_SUCCESS); 22 | } -------------------------------------------------------------------------------- /0x0C-more_malloc_free/2-calloc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "main.h" 3 | 4 | /** 5 | * _calloc - function that allocates memory 6 | * @nmemb: memory for an array 7 | * @size: size bytes 8 | * 9 | * Return: pointer to the allocated memory. 10 | */ 11 | 12 | void *_calloc(unsigned int nmemb, unsigned int size) 13 | { 14 | char *p; 15 | 16 | unsigned int i; 17 | 18 | if (nmemb == 0 || size == 0) 19 | return (NULL); 20 | p = malloc(nmemb * size); 21 | if (p == NULL) 22 | return (NULL); 23 | for (i = 0; i < (nmemb * size); i++) 24 | p[i] = 0; 25 | return (p); 26 | } 27 | -------------------------------------------------------------------------------- /0x0E-structures_typedef/dog.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | /** 4 | * struct dog - a structure of dog 5 | * @name: name of the dog 6 | * @age: the age of the dog 7 | * @owner: the ownerof the dog 8 | */ 9 | struct dog 10 | { 11 | char *name; 12 | float age; 13 | char *owner; 14 | }; 15 | typedef struct dog dog_t; 16 | 17 | void init_dog(struct dog *d, char *name, float age, char *owner); 18 | void print_dog(struct dog *d); 19 | int _putchar(char); 20 | dog_t *new_dog(char *name, float age, char *owner); 21 | void free_dog(dog_t *d); 22 | 23 | 24 | #endif /* MAIN_H */ 25 | -------------------------------------------------------------------------------- /0x10-variadic_functions/0-sum_them_all.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "variadic_functions.h" 3 | /** 4 | * sum_them_all - sum up all the arguments passed 5 | * @n: the number of arguments 6 | * Return: the sum of the arguments passed 7 | */ 8 | int sum_them_all(const unsigned int n, ...) 9 | { 10 | int sum; 11 | 12 | va_list ap; 13 | 14 | unsigned int i; 15 | 16 | if (n == 0) 17 | return (0); 18 | 19 | va_start(ap, n); 20 | 21 | sum = 0; 22 | for (i = 0; i < n; i++) 23 | { 24 | sum += va_arg(ap, int); 25 | } 26 | 27 | va_end(ap); 28 | return (sum); 29 | } 30 | -------------------------------------------------------------------------------- /0x15-file_io/0-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "main.h" 4 | 5 | /** 6 | * main - check the code for Holberton School students. 7 | * 8 | * Return: Always 0. 9 | */ 10 | int main(int ac, char **av) 11 | { 12 | ssize_t n; 13 | 14 | if (ac != 2) 15 | { 16 | dprintf(2, "Usage: %s filename\n", av[0]); 17 | exit(1); 18 | } 19 | n = read_textfile(av[1], 114); 20 | printf("\n(printed chars: %li)\n", n); 21 | n = read_textfile(av[1], 1024); 22 | printf("\n(printed chars: %li)\n", n); 23 | return (0); 24 | } 25 | -------------------------------------------------------------------------------- /0x08-recursion/5-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int r; 12 | 13 | r = _sqrt_recursion(1); 14 | printf("%d\n", r); 15 | r = _sqrt_recursion(1024); 16 | printf("%d\n", r); 17 | r = _sqrt_recursion(16); 18 | printf("%d\n", r); 19 | r = _sqrt_recursion(17); 20 | printf("%d\n", r); 21 | r = _sqrt_recursion(25); 22 | printf("%d\n", r); 23 | r = _sqrt_recursion(-1); 24 | printf("%d\n", r); 25 | return (0); 26 | } 27 | -------------------------------------------------------------------------------- /0x0F-function_pointers/3-get_op_func.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "3-calc.h" 4 | /** 5 | * get_op_func - choose the operatin to performded 6 | * @s: a string 7 | * Return: a pointer to a function 8 | */ 9 | int (*get_op_func(char *s))(int, int) 10 | { 11 | op_t ops[] = { 12 | {"+", op_add}, 13 | {"-", op_sub}, 14 | {"*", op_mul}, 15 | {"/", op_div}, 16 | {"%", op_mod}, 17 | {NULL, NULL} 18 | }; 19 | int i; 20 | 21 | for (i = 0; ops[i].op != NULL; i++) 22 | { 23 | if (s[0] == ops->op[i]) 24 | break; 25 | } 26 | return (ops[i / 2].f); 27 | } 28 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/1-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | char s1[98] = "Hello "; 12 | char s2[] = "World!\n"; 13 | char *ptr; 14 | 15 | printf("%s\n", s1); 16 | printf("%s", s2); 17 | ptr = _strncat(s1, s2, 1); 18 | printf("%s\n", s1); 19 | printf("%s", s2); 20 | printf("%s\n", ptr); 21 | ptr = _strncat(s1, s2, 1024); 22 | printf("%s", s1); 23 | printf("%s", s2); 24 | printf("%s", ptr); 25 | return (0); 26 | } 27 | -------------------------------------------------------------------------------- /0x0B-malloc_free/0-create_array.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | 5 | /** 6 | * create_array - create an array of chars, with a specific char. 7 | * @size: input size 8 | * @c: input char 9 | * Return: char 10 | */ 11 | 12 | char *create_array(unsigned int size, char c) 13 | { 14 | char *ar; 15 | unsigned int i = 0; 16 | 17 | if (size != 0) 18 | ar = malloc(size * sizeof(char)); 19 | else 20 | return (NULL); 21 | if (ar == NULL) 22 | return (NULL); 23 | for (i = 0; i < size; i++) 24 | { 25 | ar[i] = c; 26 | } 27 | return (ar); 28 | } 29 | -------------------------------------------------------------------------------- /0x02-functions_nested_loops/101-natural.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * main - computes and prints the sum of all the multiples 5 | * of 3 or 5 below 1024 6 | * Return: Always 0 (Success) 7 | */ 8 | int main(void) 9 | { 10 | unsigned long int sum3, sum5, sum; 11 | int i; 12 | 13 | sum3 = 0; 14 | sum5 = 0; 15 | sum = 0; 16 | 17 | for (i = 0; i < 1024; ++i) 18 | { 19 | if ((i % 3) == 0) 20 | { 21 | sum3 = sum3 + i; 22 | } else if ((i % 5) == 0) 23 | { 24 | sum5 = sum5 + i; 25 | } 26 | } 27 | sum = sum3 + sum5; 28 | printf("%lu\n", sum); 29 | return (0); 30 | } 31 | -------------------------------------------------------------------------------- /0x06-pointers_arrays_strings/6-cap_string.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | /** 4 | * cap_string - capitalizes all words of a string. 5 | * @s: string. 6 | * Return: string. 7 | */ 8 | char *cap_string(char *s) 9 | { 10 | char spc[] = {32, 9, '\n', ',', ';', '.', '!', '?', '"', '(', ')', '{', '}'}; 11 | int a = 0; 12 | unsigned long int i; 13 | 14 | for (a = 0; s[a] != '\0'; a++) 15 | { 16 | for (i = 0; i < strlen(spc) ; i++) 17 | { 18 | if ((a == 0 || s[a - 1] == spc[i]) && (s[a] >= 97 && s[a] <= 122)) 19 | s[a] = s[a] - 32; 20 | } 21 | } 22 | return (s); 23 | } 24 | -------------------------------------------------------------------------------- /0x08-recursion/4-main.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | 4 | /** 5 | * main - check the code 6 | * 7 | * Return: Always 0. 8 | */ 9 | int main(void) 10 | { 11 | int r; 12 | 13 | r = _pow_recursion(1, 10); 14 | printf("%d\n", r); 15 | r = _pow_recursion(1024, 0); 16 | printf("%d\n", r); 17 | r = _pow_recursion(2, 16); 18 | printf("%d\n", r); 19 | r = _pow_recursion(5, 2); 20 | printf("%d\n", r); 21 | r = _pow_recursion(5, -2); 22 | printf("%d\n", r); 23 | r = _pow_recursion(-5, 3); 24 | printf("%d\n", r); 25 | return (0); 26 | } 27 | -------------------------------------------------------------------------------- /0x0C-more_malloc_free/3-array_range.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "main.h" 3 | 4 | /** 5 | *array_range - function that creates an array of integers. 6 | *@min: min number 7 | *@max: max number 8 | * 9 | *Return: the pointer to the newly created array 10 | */ 11 | int *array_range(int min, int max) 12 | { 13 | int *ary; 14 | int i; 15 | 16 | if (min > max) 17 | return (NULL); 18 | 19 | ary = malloc(sizeof(*ary) * ((max - min + 1))); 20 | 21 | if (ary == NULL) 22 | return (NULL); 23 | 24 | for (i = 0; min <= max; i++, min++) 25 | ary[i] = min; 26 | 27 | return (ary); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/4-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "lists.h" 5 | 6 | /** 7 | * main - check the code for Holberton School students. 8 | * 9 | * Return: Always 0. 10 | */ 11 | int main(void) 12 | { 13 | list_t *head; 14 | 15 | head = NULL; 16 | add_node_end(&head, "Jennie"); 17 | add_node_end(&head, "&"); 18 | add_node_end(&head, "Jay"); 19 | add_node_end(&head, "love"); 20 | add_node_end(&head, "asm"); 21 | print_list(head); 22 | free_list(head); 23 | head = NULL; 24 | return (0); 25 | } 26 | -------------------------------------------------------------------------------- /0x12-singly_linked_lists/.history/2-add_node_20191031165115.c: -------------------------------------------------------------------------------- 1 | #include "lists.h" 2 | 3 | /** 4 | * add_note - print len. 5 | * @head: list. 6 | * @str: string. 7 | * Return: The elements linked. 8 | */ 9 | 10 | list_t *add_node(list_t **head, const char *str) 11 | { 12 | list_t *newnode; 13 | newnode = malloc(sizeof(list_t)); 14 | if (newnode == NULL) 15 | { 16 | return (NULL); 17 | } 18 | new->str = strdup(str); 19 | new->len = 5; 20 | new->next = head; 21 | head = newnode; 22 | free(newnode->str); 23 | free(newnode); 24 | return (0); 25 | } 26 | --------------------------------------------------------------------------------