7.8.1 String Operations

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Educations » Free Programming Training » C Programming »

We have already mentioned the string functions strlen, strcpy, strcat, and strcmp, found in <string.h>. In the following, s and t are char *’s, and c and n are ints.
strcat(s,t)  concatenate t to end of s
strncat(s,t,n) concatenate n characters of t to end of s
strcmp(s,t)  return negative, zero, or positive for s < t, s == t, s > t
strncmp(s,t,n) same as strcmp but only in first n characters
strcpy(s,t)  copy t to s
strncpy(s,t,n) copy at most n characters of t to s
strlen(s)  return length of s
strchr(s,c)  return pointer to first c in s, or NULL if not present
strrchr(s,c)  return pointer to last c in s, or NULL if not present


• • •
 



captcha PHP Script Free PHP captcha script free php
Website Design by WebWalas.com