Created
January 29, 2014 10:40
-
-
Save kunishi/8685471 to your computer and use it in GitHub Desktop.
Opu Experiments IB (C version), 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# There exist several targets which are by default empty and which can be | |
# used for execution of your targets. These targets are usually executed | |
# before and after some main targets. They are: | |
# | |
# .build-pre: called before 'build' target | |
# .build-post: called after 'build' target | |
# .clean-pre: called before 'clean' target | |
# .clean-post: called after 'clean' target | |
# .clobber-pre: called before 'clobber' target | |
# .clobber-post: called after 'clobber' target | |
# .all-pre: called before 'all' target | |
# .all-post: called after 'all' target | |
# .help-pre: called before 'help' target | |
# .help-post: called after 'help' target | |
# | |
# Targets beginning with '.' are not intended to be called on their own. | |
# | |
# Main targets can be executed directly, and they are: | |
# | |
# build build a specific configuration | |
# clean remove built files from a configuration | |
# clobber remove all built files | |
# all build all configurations | |
# help print help mesage | |
# | |
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and | |
# .help-impl are implemented in nbproject/makefile-impl.mk. | |
# | |
# NOCDDL | |
# Environment | |
MKDIR=mkdir | |
CP=cp | |
CCADMIN=CCadmin | |
RANLIB=ranlib | |
# build | |
build: .build-pre .build-impl .build-post | |
.build-pre: | |
# Add your pre 'build' code here... | |
.build-post: | |
# Add your post 'build' code here... | |
# clean | |
clean: .clean-pre .clean-impl .clean-post | |
.clean-pre: | |
# Add your pre 'clean' code here... | |
.clean-post: | |
# Add your post 'clean' code here... | |
# clobber | |
clobber: .clobber-pre .clobber-impl .clobber-post | |
.clobber-pre: | |
# Add your pre 'clobber' code here... | |
.clobber-post: | |
# Add your post 'clobber' code here... | |
# all | |
all: .all-pre .all-impl .all-post | |
.all-pre: | |
# Add your pre 'all' code here... | |
.all-post: | |
# Add your post 'all' code here... | |
# help | |
help: .help-pre .help-impl .help-post | |
.help-pre: | |
# Add your pre 'help' code here... | |
.help-post: | |
# Add your post 'help' code here... | |
# include project implementation makefile | |
include nbproject/Makefile-impl.mk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
char *my_strcpy(char *dest, const char *src) | |
{ | |
char *d = dest; | |
while (*src != '\0') { | |
*dest = *src; | |
src ++; | |
dest ++; | |
} | |
return d; | |
} | |
int my_strcmp(const char *s1, const char *s2) | |
{ | |
while (*s1 == *s2) { | |
if (*s1 == '\0' || *s2 == '\0') | |
break; | |
s1 ++; | |
s2 ++; | |
} | |
return *s1 - *s2; | |
} | |
char *my_strcat(char *dest, const char *src) | |
{ | |
char *d = dest; | |
while (*dest != '\0') | |
dest ++; | |
while (*src != '\0') { | |
*dest = *src; | |
src ++; | |
dest ++; | |
} | |
*dest = '\0'; | |
return d; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: strmain.c | |
* Author: kunishi | |
* | |
* Created on 2008/11/25, 14:42 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
char *my_strcat(char *, const char *); | |
int my_strcmp(const char *, const char *); | |
char *my_strcpy(char *, const char *); | |
/* | |
* | |
*/ | |
int main(int argc, char** argv) { | |
char s1[100]; | |
char *s2 = "test"; | |
char *s3 = "testtest"; | |
printf("%s\n", my_strcpy(s1, s2)); | |
printf("%d\n", my_strcmp(s2, s3)); | |
printf("%s\n", my_strcat(s1, s2)); | |
return (EXIT_SUCCESS); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment