wmemchr() function in C/C++ Last Updated : 05 Feb, 2021 Comments Improve Suggest changes Like Article Like Report The wmemchr() function in C/C++ Locate character in block of wide characters. This function searches within the first num wide characters of the block pointed by ptr for the first occurrence of ch, and returns a pointer to it. Syntax: const wchar_t* wmemchr( const wchar_t* ptr, wchar_t ch, size_t num ) or wchar_t* wmemchr( wchar_t* ptr, wchar_t ch, size_t num ) Parameters: The function accepts three mandatory parameters which are described below: ptr: specifies the pointer to the character array to be searched for.ch: specifies the character to be located.num: specifies the number of elements of type wchar_t to compare. Return value: The function returns two value as below: On success, it returns a pointer to the location of character array.Otherwise, NULL pointer is returned. Below programs illustrate the above function: Program-1 : C++ // C++ program to illustrate // wmemchr() function #include <bits/stdc++.h> using namespace std; int main() { // initialize the string to be scanned wchar_t ptr[] = L"GeeksForGeeks"; // character to be searched for wchar_t ch = L'o'; // length, till the character to be search for is 8 // run the function to check if the character is present bool look = wmemchr(ptr, ch, 8); if (look) wcout << "'" << ch << "'" << L" is present in first " << 8 << L" characters of \"" << ptr << "\""; else wcout << "'" << ch << "'" << L" is not present in first " << 8 << L" characters of \"" << ptr << "\""; return 0; } Output: 'o' is present in first 8 characters of "GeeksForGeeks" Program 2 : C++ // C++ program to illustrate // wmemchr() function #include <bits/stdc++.h> using namespace std; int main() { // initialize the string to be scanned wchar_t ptr[] = L"GFG"; // character to be searched for wchar_t ch = L'p'; // length, till the character to be search for is 3 // run the function to check if the character is present bool look = wmemchr(ptr, ch, 3); if (look) wcout << "'" << ch << "'" << L" is present in first " << 3 << L" characters of \"" << ptr << "\""; else wcout << "'" << ch << "'" << L" is not present in first " << 3 << L" characters of \"" << ptr << "\""; return 0; } Output: 'p' is not present in first 3 characters of "GFG" Comment More infoAdvertise with us Next Article wmemchr() function in C/C++ A AmanSrivastava1 Follow Improve Article Tags : Misc C Language C++ CPP-Functions C-Library +1 More Practice Tags : CPPMisc Similar Reads C Programming Language Tutorial C is a general-purpose mid-level programming language developed by Dennis M. Ritchie at Bell Laboratories in 1972. It was initially used for the development of UNIX operating system, but it later became popular for a wide range of applications. Today, C remains one of the top three most widely used 5 min read C++ Programming Language C++ is a computer programming language developed by Bjarne Stroustrup as an extension of the C language. It is known for is fast speed, low level memory management and is often taught as first programming language. It provides:Hands-on application of different programming concepts.Similar syntax to 5 min read SQL Commands | DDL, DQL, DML, DCL and TCL Commands SQL commands are crucial for managing databases effectively. These commands are divided into categories such as Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Data Query Language (DQL), and Transaction Control Language (TCL). In this article, we will e 7 min read TCP/IP Model The TCP/IP model (Transmission Control Protocol/Internet Protocol) is a four-layer networking framework that enables reliable communication between devices over interconnected networks. It provides a standardized set of protocols for transmitting data across interconnected networks, ensuring efficie 7 min read Object Oriented Programming in C++ Object Oriented Programming - As the name suggests uses objects in programming. Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism, etc. in programming. The main aim of OOP is to bind together the data and the functions that operate on them so th 5 min read Basics of Computer Networking A computer network is a collection of interconnected devices that share resources and information. These devices can include computers, servers, printers, and other hardware. Networks allow for the efficient exchange of data, enabling various applications such as email, file sharing, and internet br 14 min read Unified Modeling Language (UML) Diagrams Unified Modeling Language (UML) is a general-purpose modeling language. The main aim of UML is to define a standard way to visualize the way a system has been designed. It is quite similar to blueprints used in other fields of engineering. UML is not a programming language, it is rather a visual lan 14 min read Waterfall Model - Software Engineering The Waterfall Model is a Traditional Software Development Methodology. It was first introduced by Winston W. Royce in 1970. It is a linear and sequential approach to software development that consists of several phases. This classical waterfall model is simple and idealistic. It is important because 13 min read Java Programs - Java Programming Examples In this article, we will learn and prepare for Interviews using Java Programming Examples. From basic Java programs like the Fibonacci series, Prime numbers, Factorial numbers, and Palindrome numbers to advanced Java programs.Java is one of the most popular programming languages today because of its 8 min read Python Lists In Python, a list is a built-in dynamic sized array (automatically grows and shrinks). We can store all types of items (including another list) in a list. A list may contain mixed type of items, this is possible because a list mainly stores references at contiguous locations and actual items maybe s 6 min read Like