Skip to content

Commit 22b9648

Browse files
Code: added code for 7-leet.c
1 parent a1f7a20 commit 22b9648

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

0x06-pointers_arrays_strings/7-leet.c

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include "main.h"
2+
3+
/**
4+
* leet - encode into 1337speak
5+
*
6+
* @n: input value
7+
*
8+
* Return: n value
9+
*/
10+
11+
char *leet(char *n)
12+
{
13+
int i, j;
14+
char s1[] = "aAeEoOtTlL";
15+
char s2[] = "4433007711";
16+
17+
for (i = 0; n[i] != '\0'; i++)
18+
{
19+
for (j = 0; j < 10; j++)
20+
{
21+
if (n[i] == s1[j])
22+
{
23+
n[i] = s2[j];
24+
}
25+
}
26+
}
27+
return (n);
28+
}

0 commit comments

Comments
 (0)