#include /* strlen: return length of string s int strlen(char *s) { int n; for (n = 0; *s != '\0'; s++); n++; return n; } */ /* strlen: return length of string s */ int strlen(char *s) { char *p = s; while (*p != '\0') p++; return p - s; } /* strcpy: copy t to s; array subscript version */ void strcpy(char *s, char *t) { int i; i = 0; while ((s[i] = t[i]) != '\0') i++; } /* strcpy: copy t to s; pointer version void strcpy(char *s, char *t) { int i; i = 0; while ((*s = *t) != '\0') { s++; t++; } } */ /* strcpy: copy t to s; pointer version 2 void strcpy(char *s, char *t) { while ((*s++ = *t++) != '\0') ; } */ /* strcpy: copy t to s; pointer version 3 void strcpy(char *s, char *t) { while (*s++ = *t++) ; } */ int strcmp(char *s, char *t) { int i; for (i = 0; s[i] == t[i]; i++) if (s[i] == '\0') return 0; return s[i] - t[i]; } /* strcmp: return <0 if s0 if s>t int strcmp(char *s, char *t) { for ( ; *s == *t; s++, t++) if (*s == '\0') return 0; return *s - *t; } */ int main() { printf("Duzina ove niske je : %d\n", strlen("Duzina ove niske je:")); printf("%d\n" , strcmp("A prva","C druga")); return 0; }