C examples for String:String Function
computes the length of string str, pointer based
int strlen(char *str) { int p; for(p = 0; *str != '\0'; str++) p++; return p; }
#include <stdio.h> int strlen(char *str) { int p;//from ww w . ja v a 2 s . c om for(p = 0; *str != '\0'; str++) p++; return p; } int main(void) { char *str = "this is a test"; int len = strlen(str); printf("%d",len); return 0; }