- Trending Categories
- 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 7346 Articles for C++
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
580 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
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 the values of variables but the value of variables will remain same at the actual place.Here is an example of swap() in C++ language, Example Live Demo#include using namespace std; int main() { int x = 35, y = 75; printf("Value of x :%d", x); printf("Value of ... Read More
157 Views
The function iswdigit() is a built-in function in C/C++. It checks whether the wide character is a decimal digit or not. It is declared in “cwctype” header file in C++ language while “ctype.h” in C language. It takes a single character which is known as wide character.The characters from 0 to 9 are classified as decimal digits. If the wide character is not a digit, it will return zero(0). If character is digit, it will return non-zero value.Here is the syntax of iswdigit() in C++ language, int iswdigit(ch)Here is an example of iswdigit() in C++ language, Example Live Demo#include #include ... Read More
167 Views
The function iswupper() is a built-in function in C/C++. It converts the wide character into upper case. It is declared in “cwctype” header file in C++ language while “ctype.h” in C language. It takes a single character which is known as wide character. If the character is upper case, it is converted into it, otherwise no modifications happen.Here is the syntax of towupper() in C++ language, wint_t towupper( wint_t ch );Here is an example of towupper() in C++ language, Example#include #include #include using namespace std; int main() { wchar_t s[] = L"hello world!"; wcout Read More
152 Views
The function iswlower() is a built-in function in C/C++. It checks whether the wide character is in lower case or not. It is declared in “cwctype” header file in C++ language while “ctype.h” in C language. It takes a single character which is known as wide character. It will return zero(0), if the character is not a lower case character. It will return non-zero value, if character is lower case.Here is the syntax of iswlower() in C/C++ language, int iswlower(ch);Here is an example of iswlower() in C++ language, Example Live Demo#include #include using namespace std; int main() { ... Read More
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 one.Here is an example of array decay in C++ language,Example Live Demo#include using namespace std; void DisplayValue(int *p) { cout
720 Views
Enumeration is a user defined datatype in C language. It is used to assign names to the integral constants, which makes a program easy to read and maintain. The keyword “enum” is used to declare an enumeration.Here is the syntax of enum in C language, enum enum_name{const1, const2, ....... };The enum keyword is also used to define the variables of enum type. There are two ways to define the variables of enum type as follows.enum week{sunday, monday, tuesday, wednesday, thursday, friday, saturday}; enum week day;Here is an example of enum in C language, Example#include enum week{Mon=10, Tue, Wed, Thur, Fri=10, ... Read More
27K+ Views
The function strcmp() is a built-in library function and it is declared in “string.h” header file. This function is used to compare the string arguments. It compares strings lexicographically which means it compares both the strings character by character. It starts comparing the very first character of strings until the characters of both strings are equal or NULL character is found.If the first character of both strings are equal, it checks second character and so on. This process will be continued until NULL character is found or both characters are unequal.Here is the syntax of strcmp() in C language, int ... Read More
4K+ Views
The function strcpy() is a standard library function. It is used to copy one string to another. In C language, it is declared in “string.h” header file while in C++ language, it is declared in cstring header file. It returns the pointer to the destination.Here is the syntax of strcpy() in C language, char* strcpy(char* dest, const char* src);Some key points of strcpy().It copies the whole string to the destination string. It replaces the whole string instead of appending it.It won’t change the source string.Here is an example of strcpy() in C language, Example Live Demo#include #include int main() { ... Read More