C Foundation

What is C? C Compiler Installation C Extensions C Compiler C Interpreter C Program Structure

C Basics

C Keywords C Data Types C Identifiers C Variables C Constant C Escape Sequences C Constant and Volatile C Typecast

Operators

What is Operator C Comma Operator C Arithmetic Operators C Relational Operators C Logical Operators C Bitwise Operators C Conditional Operators C : : Operator C Operator Priority

Basic IO's

Basic IO's C Formatted Functions C Unformatted Functions C Common Functions

Control Statements

What is Control Statement C if Statement C if else Statement C Nested if Statement C Else if Statement C Break Statement C Continue Statement C Switch Statement C Goto Statement

Looping

What is Control Loop C for Loop C Nested for Loop C while Loop C Nested while Loop C do while Loop C Nested do while loop

Functions

What is Function C User Defined Functions C Recursion C Passing Parameters

Scope

Scope C Local Scope C Global Scope

Storage Classes

What is Storage Class C Auto C Extern C Static C Register

Array

What is Array C One Dimensional Array C Two Dimensional Array C Multi Dimensional Array C Arrays Of Strings

String

What is String C String Functions

Pointer

What is Pointer C Pointers Arithmetic C Pointer to Pointer C Pointers and Arrays C Pointers and Strings C Pointer to Functions Void Pointers Null Pointers C Null and Void Pointer

Structure

What is Structure C Struct within Struct C Array within Structure C Pointer to Structure C Structure and Function C Enum C Bitfield Structure C Type def

Union

What is Union

Files

What is File C read a file C write a file C File Handling C Error Handling C Low Level Disk I/O C Other file functions

Memory Allocation

What is Memory Allocation C Malloc() C Calloc() C Free() C Realloc() C Coreleft()

C Reference

All ASCII Code Basic C Questions

C Interview

C Interview Sets All Star Patterns All Number Patterns All Alphabet Patterns All Series Patterns
The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C String Functions

C programming provides several inbuilt functions for string to make our programming crystal clear because several lines of coding will be reduced to a word by using standard inbuilt string functions. The definitions for all inbuilt functions in c are written in #include<string.h> library.

string functions in c

Complete String Funtions In C

Return Type Function Call Purpose
char * strcat(str1,str2) To concatenate or join str2 with str1.
char * strncat(str1,str2,n) Concatenate at most n characters of string str2 to string str1, terminate with '\0' and returns str1.
char * strchr(st,ch) To find the first occurrence of a character ch in a string st.
char * strrchr(st,ch) To find the last occurrence of a character ch in a string st.
char * strcpy(str2,str1) To copy a string from str1 to str2.
char * strncpy(str1,str2,n) Concatenate at most n characters of string str2 to string str1, terminate with '\0' and return str1.
size_t strlen(str1) Returns length of a string str1.
char * strstr(str1,str2) Returns a string str2 if it is present in string str1. If not retruns NULL
char * strpbrk(str1,str2) To print the string str1 from the first occurrence of any one of the given individual character in str2.
char * strerror Return "No error" if a file is found else throw a error message.
char * strlwr(str) To convert upper case letters in a string str to lower case letters.
char * strupr(str) To convert lower case letters in a string str to upper case letters.
char * strdup(str) To duplicate a string str.
char * strtok(str, chr) To replace a symbol char with '\n'(new line) in a string str.
int strcmp(str1,str2) Compare str1 and str2 and return -1 if str1<str2, 0 if str1 == str2 or +1 if str1>str2.
int stricmp(str1,str2) Same as strcmp(str1, str2) but stricmp(str1, str2) is case insensitive.
int strncmp(str1,str2,n) Compare at most n characters of string str1 to string str2 and return -1 if str1<str2, 0 if str1==str2 or +1 if str1>str2.
int strnicmp(str1,str2,str3) Same as strncmp(str1,str2,n) but strnicmp(str1,str2,str3) is case insensitive
int strspn(str1,str2) Return length of prefix of str1 consisting of characters in str2.
int strcspn(str1,str2) Return length of perfix of str1 consisting of characters not in str2.
char * strrev(str1) To reverse the source string str1.
char * strset(str1,char) To replace a string str1 with specified character char.
char * strnset(str1,char,n) To replace a string str1 with specified character char up to specified length n.
char * strswab(str1) Swapping adjacent characters in a string str1 consecutively.
void * memcpy(str1,str2,n) Copy n characters from str2 to str1 and return str1.
void * memmove(str1,str2,n) Copy n characters from str2 to str1 , and return str1. It works even if the object overlap.
int memcmp(str1,str2,n) Compares the first n characters of str1 with str2 and returns as with strcmp.
void * memchr(str1,chr,n) Return a string str1 from a character chr if a character chr present in a string str1 within a length n else return null.
void * memset(str1,chr,n) Place character chr into first n characters of a string str1 and return str1.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report