Main Function in C

There must be at least one function in any C source code. This is called as Main() and is a mandetory requirement of C language. This is the entry point of any C program. From main() function the code execution flows as per the programmer’s chosen custom functions. There may or may not be other functions written by user in a program.

Basic C Structure


A sample C Program template can be as simple as below. The famous “Hello World”
is the famous program among the people interested to learn this language.

#include<stdio.h>
int
main()                               
{     
        –other statements
}

String standard functions


Functions
Description
Strlen()
Determines the length of a string
Strcpy()
Copies  a string from source to destination
Strncpy()
Copies characters of a string to another string up to the specified length
Stricmp()
Compares characters of two strings
Strcmp()
Compares characters of two strings up to the specified length
Strncmp()
Compares characters of two strings up to the specified length
Strnicmp()
Compares characters of two strings up to the specified length
Strlwr()
Converts uppercase characters of a string to lower case
Strupr()
Converts lowercase characters of a string to upper case
Strdup()
Duplicates a string
Strchr()
Determines the first occurrence of a given character in a string
Strrchr()
Determines the last occurrence of a given character in a string
Strstr()
Determines the first occurrence of a given string in another string
Strcat()
Appends source string to destination string
Strrev()
Reverses all characters of a string
Strset()
Sets all characters of a string with a given argument or symbol
Strspn()
Finds up to what length two strings are identical
Strpbrk()
Searches the first occurrence of the character in a given string and then displays the string starting from that character

sprintf()


This function is similar to the printf() function except for a small difference between them. The printf() function sends the output to the screen whereas the sprint() function writes the values of any data type to an array of characters.