0X09 - Static Libraries (Source Code)
0X09 - Static Libraries (Source Code)
README.md
C - Static libraries
TASKS
================================================================
MAIN.H
#ifndef
_MAIN_H
_
#define _MAIN_H_
#endif
================================================================
0-putchar.c
#include <unistd.h>
/**
* Return: On success 1.
*/
int _putchar(char c)
============================
0-isupper.c
#include "main.h"
/**
* Return: 0 or 1
*/
int _isupper(int c)
return (1);
else
return (0);
============================
0-memset.c
#include
"main.h"
/**
*/
int a = 0;
s[a] = b;
n--;
return (s);
============================
0-strcat.c
#includ
e
"main.h
"
/**
* _strcat - function that concatenates two
strings
* Return: void
*/
int a;
int b;
a = 0;
a++;
b = 0;
dest[a] = src[b];
a++;
b++;
}
dest[a] = '\0';
return (dest);
============================
1-isdigit.c
#include "main.h"
/**
int _isdigit(int c)
============================
1-memcpy.c
#include "main.h"
/**
*/
{
int r = 0;
int i = n;
dest[r] = src[r];
n--;
return (dest);
============================
1-strncat.c
#includ
e
"main.h
"
/**
* _strncat - function concatenate two
strings
* Return: dest
*/
int a;
int b;
a = 0;
a++;
b = 0;
dest[a] = src[b];
a++;
b++;
dest[a] = '\0';
return (dest);
============================
2-strchr.c
#include "main.h"
/**
* @s: input
* @c: input
*/
char *_strchr(char *s, char c)
int i = 0;
if (s[i] == c)
return (&s[i]);
return (0);
============================
2-strlen.c
#include "main.h"
/**
* @s: string
* Return: length
*/
int longi = 0;
longi++;
s++;
return (longi);
============================
2-strncpy.c
#include "main.h"
/**
* Return: dest
*/
int j;
j = 0;
dest[j] = src[j];
j++;
while (j < n)
dest[j] = '\0';
j++;
return (dest);
}
============================
3-islower.c
#include "main.h"
/**
*/
int _islower(int c)
============================
3-puts.c
#include "main.h"
#include<stdio.h>
/**
*/
int main(void)
return (0);
============================
3-strcmp.c
#include "main.h"
/**
* _strcmp - compare string values
*/
int i;
i = 0;
if (s1[i] != s2[i])
i++;
return (0);
}
============================
3-strspn.c
#include "main.h"
/**
* @s: input
* @accept: input
*/
unsigned int n = 0;
int r;
while (*s)
if (*s == accept[r])
{
n++;
break;
return (n);
s++;
return (n);
============================
4-isalpha.c
#include "main.h"
/**
*/
int _isalpha(int c)
return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
============================
4-strpbrk.c
#include "main.h"
/**
* @s: input
* @accept: input
*/
{
int k;
while (*s)
if (*s == accept[k])
return (s);
s++;
return ('\0');
============================
5-strstr.c
#include "main.h"
/**
* @haystack: input
* @needle: input
*/
char *l = haystack;
char *p = needle;
l++;
p++;
if (*p == '\0')
return (haystack);
return (0);
}
============================
6-abs.c
#include "main.h"
/**
*/
int _abs(int n)
if (n >= 0)
return (n);
return (-n);
}
============================
9-strcpy.c
#includ
e
"main.h
"
/**
* @dest: copy to
*/
char *_strcpy(char *dest, char *src)
int a = 0;
int b = 0;
a++;
dest[b] = src[b];
}
dest[a] = '\0';
return (dest);
============================
100-atoi.c
#include "main.h"
/**
* Return: integer.
*/
int _atoi(char *s)
int sign = 1, i = 0;
while (!(s[i] <= '9' && s[i] >= '0') && s[i] != '\0')
if (s[i] == '-')
sign *= -1;
i++;
while (s[i] <= '9' && (s[i] >= '0' && s[i] != '\0'))
i++;
res *= sign;
return (res);
============================
main.h
#ifndef MAIN_H
#define MAIN_H
#endif
============================
README.md
C - Static libraries
TASKS