Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6a39fd0b
authored
Dec 06, 2015
by
triazo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
write simple memcpy function
parent
55d156d8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
src/string.c
src/string.h
src/string.c
View file @
6a39fd0b
#include "string.h"
#include <stdbool.h>
void
*
memset
(
void
*
s
,
int
c
,
size_t
n
){
void
*
memset
(
void
*
s
,
int
c
,
size_t
n
)
{
unsigned
char
*
p
=
s
;
while
(
n
--
)
*
p
++=
(
unsigned
char
)
c
;
return
s
;
}
void
memcpy
(
void
*
dest
,
void
*
src
,
size_t
n
)
{
size_t
i
;
char
*
d
=
(
char
*
)
dest
;
char
*
s
=
(
char
*
)
src
;
for
(
i
=
0
;
i
<
n
;
++
i
)
{
d
[
i
]
=
s
[
i
];
}
}
void
reverse
(
char
s
[]
)
{
int
c
,
i
,
j
;
...
...
src/string.h
View file @
6a39fd0b
...
...
@@ -2,7 +2,8 @@
#define _STRING_ING
#include<stddef.h>
void
*
memset
(
void
*
s
,
int
c
,
size_t
n
);
void
*
memset
(
void
*
s
,
int
c
,
size_t
n
);
void
memcpy
(
void
*
dest
,
void
*
src
,
size_t
n
);
void
itoa
(
int
n
,
char
s
[]);
size_t
strlen
(
const
char
*
str
);
int
strcmp
(
const
char
*
s1
,
const
char
*
s2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment