Samual Sam has Published 2492 Articles

strspn() in C

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:28:22

135 Views

The function strspn() is used to calculate the length of substring of first string which is present in second string. It returns the length of that substring.Here is the syntax of strspn() in C language, size_t strspn(const char *string1, const char *string2);Here is an example of strspn() in C language, ... Read More

Use of fflush(stdin) in C

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:27:30

6K+ Views

The function fflush(stdin) is used to flush the output buffer of the stream. It returns zero, if successful otherwise, returns EOF and feof error indicator is set.Here is the syntax of fflush(stdin) in C language, int fflush(FILE *stream);Here is an example of fflush(stdin) in C language, Example Live Demo#include #include int ... Read More

rand() and srand() in C

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:26:35

13K+ Views

rand()The function rand() is used to generate the pseudo random number. It returns an integer value and its range is from 0 to rand_max i.e 32767.Here is the syntax of rand() in C language, int rand(void);Here is an example of rand() in C language, Example Live Demo#include #include int main() ... Read More

swap() function in C++

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:22:01

21K+ Views

The swap() function is used to swap two numbers. By using this function, you do not need any third variable to swap two numbers.Here is the syntax of swap() in C++ language, void swap(int variable_name1, int variable_name2);If we assign the values to variables or pass user-defined values, it will swap ... Read More

new and delete operator in C++

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:20:50

14K+ Views

The new operatorThe new operator requests for the memory allocation in heap. If the sufficient memory is available, it initializes the memory to the pointer variable and returns its address.Here is the syntax of new operator in C++ language, pointer_variable = new datatype;Here is the syntax to initialize the memory, ... Read More

Const member functions in C++

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:19:02

17K+ Views

The const member functions are the functions which are declared as constant in the program. The object called by these functions cannot be modified. It is recommended to use const keyword so that accidental changes to object are avoided.A const member function can be called by any type of object. ... Read More

Difference between %d and %i format specifier in C

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:17:57

2K+ Views

Format Specifier %dThe format specifier %d takes integer value as a signed decimal integer value which means values should be decimal whether it is negative or positive.Here is an example of format specifier %d in C language, Example Live Demo#include int main() {    int v1 = 7456;    int ... Read More

strpbrk() in C

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:16:33

972 Views

The function strpbrk() is used to find the first character of first string and matches it to any character of second string. It returns NULL, if no matches are found otherwise, it returns a pointer to the character of first string that matches to the character of second string.Here is ... Read More

Strings in C Language

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:12:17

1K+ Views

String is an array of characters and terminated by a null character (\0). The null character is not placed by the user, the compiler places it at the end of string automatically.The difference between an array and a string is that the compiler does not place null character at the ... Read More

What is Array Decay in C++?

Samual Sam

Samual Sam

Updated on 24-Jun-2020 11:11:21

2K+ Views

The loss of type and dimensions of an array is known as array decay. It occurs when we pass the array into a function by pointer or value. First address is sent to the array which is a pointer. That is why, the size of array is not the original ... Read More

Advertisements