Commit 53762538 by 정용석

NULL 포인터 예외처리

parent f7e04d15
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#include <stdlib.h> #include <stdlib.h>
unsigned int my_strlen(const char *s){ unsigned int my_strlen(const char *s){
if(s == NULL){
return -1;
}
unsigned int i = 0; unsigned int i = 0;
while(s[i] != '\0'){ while(s[i] != '\0'){
i++; i++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment