Commit bdc17b34 by 정용석

.cpp 제거

parent 91490d5f
......@@ -107,6 +107,7 @@ Array, Linked List, Queue, Stack, Graph, Set, Map, Tree, Heap, ..
void my_strcpy(char *s1, char *s2) {
while(*s1++ = *s2++);
}
quiz6.cpp 참고
질문n. 자기자신을 출력하는 프로그램(quine)을 가장 자신있는 언어로 작성해보세요.
\ No newline at end of file
질문n. 자기자신을 출력하는 프로그램(quine)을 가장 자신있는 언어로 작성해보세요.
quine.cpp 참고
\ No newline at end of file
#include <stdio.h>
char S[] = "#include <stdio.h>%cchar S[] = %c%s%c;%cint main() { printf(S, 10, 34, S, 34, 10); return 0; }";
int main() { printf(S, 10, 34, S, 34, 10); return 0; }
\ No newline at end of file
#include <stdio.h>
#include <stdlib.h>
unsigned int my_strlen(char *s){
unsigned int i = 0;
while(s[i] != '\0'){
i++;
}
return i;
}
void my_strcpy(char *s1, char *s2) {
char copyS2[my_strlen(s2) + 1];
int i = 0;
while(s2[i] != '\0'){
copyS2[i] = s2[i];
i++;
}
if(my_strlen(s1) <= my_strlen(s2)){
printf("Error : 첫 번째 인자의 배열의 크기가 두 번째 인자의 크기보다 작기 때문에 정상적인 복사가 되지않습니다.\n");
}else{
while(*s1++ = *s2++);
}
}
int main() {
char s1[] = "abcd";
char s2[] = "efghijk";
my_strcpy(s1, s2);
printf("%s\n%s\n", s1, s2);
char s3[] = "abcdefg";
char s4[] = "hijk";
my_strcpy(s3, s4);
printf("%s\n%s\n", s3, s4);
return 0;
}
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