-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_string.c
37 lines (28 loc) · 966 Bytes
/
my_string.c
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
https://powcoder.com
代写代考加微信 powcoder
Assignment Project Exam Help
Add WeChat powcoder
/*************************************************************************/
/* File Name : my_string.c */
/* Purpose : this C-file defines the functions previously declared */
/* in the my_string.h header file */
/* */
/* Author(s) : tjf & you */
/*************************************************************************/
#include "my_string.h"
// strlen functions takes in a pointer to a string and return its length
//
size_t2 my_strlen (const char *str) {
size_t2 len = 0 ;
while (str[len] != '\0') { // count up to the first NULL
len++ ;
}
return (len) ;
}
size_t2 my_strlen2 (const char *str) {
const char* s;
for (s = str; *s; ++s) ;
return (s - str);
}
/* CIT 593 students: TODO: implement the remaining string functions
that were declared in my_string.h */