-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions2.c
More file actions
72 lines (61 loc) · 893 Bytes
/
functions2.c
File metadata and controls
72 lines (61 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "main.h"
/**
* print_c - prints a character
* @list: list of arguments
* Return: a char
*/
int print_c(va_list list)
{
char c;
c = va_arg(list, int);
_putchar(c);
return (1);
}
/**
* print_s - prints a string
* @list: list of arguments
* Return: a string
*/
int print_s(va_list list)
{
int i;
char *str2;
str2 = va_arg(list, char *);
if (str2 == NULL)
{
_printf("(null)");
return (6);
}
for (i = 0; str2[i] != '\0'; i++)
_putchar(str2[i]);
return (i);
}
/**
* print_mod - prints the mod sign
* @list: list of arguments
* Return: a '%' sign
*/
int print_mod(va_list list)
{
if (list != NULL)
{
}
_putchar('%');
return (1);
}
/**
* _strlen - calculates the length of a string
* @s: the string
* Return: the length of the string
*/
int _strlen(char *s)
{
if (*s == '\0')
{
return (0);
}
else
{
return (1 + _strlen(s + 1));
}
}