![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34549 Articles for Programming
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
133 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,Example Live Demo#include #include int main() { const char s1[] = "Helloworld!"; const char s2[] = "Hello"; int length = strspn(s1, s2); printf("The length of string : %d", length); return 0; }OutputThe length of string : 5
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
175 Views
The function strcoll() is used to compare two strings using locale - specific collating sequence.It returns −zero, when both strings are same, greater than zero value when first string is greater than otherless than zero value, when first string is less than other.Here is the syntax of strcoll() in C language, int strcoll(const char *first_string, const char *second_string);Here is an example of strcoll() in C language, Example Live Demo#include #include int main () { const char s1[] = "Helloworld"; const char s2[] = "Blank"; char *result; result = strcoll(s1, s2); if(result > 0) ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
963 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 the syntax of strpbrk() in C language, char *strpbrk(const char *string1, const char *string2)Here is an example of strpbrk() in C language, Example Live Demo#include #include int main () { const char s1[] = "Helloworld"; const char s2[] = "Blank"; char *result; result = strpbrk(s1, ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
2K+ Views
Function scanf()The function scanf() is used to read formatted input from stdin in C language. It returns the whole number of characters written in it otherwise, returns a negative value.Here is the syntax of scanf() in C language, int scanf(const char *characters_set)Here is an example of scanf() in C language, Example Live Demo#include int main () { char s[20]; printf("Enter a string : "); scanf("%s", s); printf("Entered string : %s", s); return(0); }OutputEnter a string : Peter! Entered string : Peter!Function fscanf()The function fscanf() is used to read the formatted input from the given stream ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
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 v2 = -17346; printf("The value in decimal form : %d", v1); printf("The value in negative : %d", v2); return 0; }OutputThe value in decimal form : 7456 The value in negative : -17346Format Specifier %iThe format specifier %i takes integer value as an integer value which means ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
545 Views
atol() FunctionThe function atol() converts string into a long integer. It returns zero, when no conversion is performed. It returns the converted long int value.Here is the syntax of atol in C++ language,long int atol(const char *string)Here is an example of atol() in C++ language,Example Live Demo#include using namespace std; int main() { long int a; char str[20] = "538756"; a = atol(str); cout
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
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. Non-const functions can be called by non-const objects only.Here is the syntax of const member function in C++ language, datatype function_name const();Here is an example of const member function in C++, Example Live Demo#include using namespace std; class Demo { int val; public: Demo(int x = 0) { ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
4K+ Views
The ceil FunctionThe ceil function returns the smallest possible integer value which is equal to the value or greater than that. This function is declared in “cmath” header file in C++ language. It takes single value whoes ceil value is to be calculated. The datatype of variable should be double/float/long double only.Here is the syntax of ceil function in C++ language, double ceil(double x); float ceil(float x);Here is an example of ceil function in C++ language, Example Live Demo#include #include using namespace std; int main() { float var = 1234.25; float res; res = ceil(var); ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
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, pointer_variable = new datatype(value);Here is the syntax to allocate a block of memory, pointer_variable = new datatype[size];Here is an example of new operator in C++ language, Example#include using namespace std; int main () { int *ptr1 = NULL; ptr1 = new int; float *ptr2 = new ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
570 Views
The CHAR_BIT is the number of bits in char. It is declared in “limits.h” header file in C++ language. It is of 8-bits per byte.Here is an example of CHAR_BIT in C++ language,Example Live Demo#include using namespace std; int main() { int x = 28; int a = CHAR_BIT*sizeof(x); stack s; cout