Code Monkey home page Code Monkey logo

alx-low_level_programming's Introduction

Alx Low Level Programming

#C - Even more pointers, arrays and strings

#TASKS.

  1. memset

Write a function that fills memory with a constant byte.

Prototype: char *_memset(char *s, char b, unsigned int n); The _memset() function fills the first n bytes of the memory area pointed to by s with the constant byte b Returns a pointer to the memory area s

  1. memcpy

Write a function that copies memory area.

Prototype: char *_memcpy(char *dest, char *src, unsigned int n); The _memcpy() function copies n bytes from memory area src to memory area dest Returns a pointer to dest FYI: The standard library provides a similar function: memcpy. Run man memcpy to learn more.

  1. strchr

Write a function that locates a character in a string.

Prototype: char *_strchr(char *s, char c); Returns a pointer to the first occurrence of the character c in the string s, or NULL if the character is not found FYI: The standard library provides a similar function: strchr. Run man strchr to learn more.

  1. strspn

Write a function that gets the length of a prefix substring.

Prototype: unsigned int _strspn(char *s, char *accept); Returns the number of bytes in the initial segment of s which consist only of bytes from accept FYI: The standard library provides a similar function: strspn. Run man strspn to learn more.

  1. strpbrk

Write a function that searches a string for any of a set of bytes.

Prototype: char *_strpbrk(char *s, char *accept); The _strpbrk() function locates the first occurrence in the string s of any of the bytes in the string accept Returns a pointer to the byte in s that matches one of the bytes in accept, or NULL if no such byte is found FYI: The standard library provides a similar function: strpbrk. Run man strpbrk to learn more.

  1. strstr

Write a function that locates a substring.

Prototype: char *_strstr(char *haystack, char *needle); The _strstr() function finds the first occurrence of the substring needle in the string haystack. The terminating null bytes (\0) are not compared Returns a pointer to the beginning of the located substring, or NULL if the substring is not found. FYI: The standard library provides a similar function: strstr. Run man strstr to learn more.

  1. Chess is mental torture

Write a function that prints the chessboard.

Prototype: void print_chessboard(char (*a)[8]);

  1. The line of life is a ragged diagonal between duty and desire

Write a function that prints the sum of the two diagonals of a square matrix of integers.

Prototype: void print_diagsums(int a, int size); Format: see example You are allowed to use the standard library Note that in the following example we are casting an int[][] into an int. This is not something you should do. The goal here is to make sure you understand how an array of array is stored in memory.

  1. Double pointer, double fun

Write a function that sets the value of a pointer to a char.

Prototype: void set_string(char **s, char *to);

  1. My primary goal of hacking was the intellectual curiosity, the seduction of a

Create a file that contains the password for the crackme2 executable.

Your file should contain the exact password, no new line, no extra space ltrace, ldd, gdb and objdump can help You may need to install the openssl library to run the crakme2 program: sudo apt install libssl-dev Edit the source list sudo nano /etc/apt/sources.list to add the following line: deb http://security.ubuntu.com/ubuntu xenial-security main Then sudo apt update and sudo apt install libssl1.0.0

alx-low_level_programming's People

Contributors

stcode-96 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.