String functions of C program

strcat()Append string
strncat()Append part of the string
strcpy()Copy string
strncpy()Copy part of a string
strlen() Length of a string
strrev() String Reverse
strlwr() Upper to lowercase letter
strupr() Lower to Uppercase letter
strchr() Searching for first occurrence of chracter
strrchr() Searching for last occurrence of chracter
strcmp() Case sensitive string comparison
strcmpi() Case insensitive string comparison
strstr() Searching for string
strset() Setting all chars of the string
strnset() Setting part of the chars of the string
strdup() Duplicating string
strtok() Parses a string into sequence of tokens
Basic string assignments

Sample Codes

Printing string vertically with total number of chars
#include <stdio.h>
int main(void){
int i;
char str[]="Welcome";

for ( i=0;str[i] != '\0';i++){
printf( "%c \n",str[i]);
printf("\n Total number of chars = %d",i);
return 0;

 Total number of chars = 7
C Tutorials

Post your comments , suggestion , error , requirements etc here

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 All rights reserved worldwide Privacy Policy Disclaimer