wprintf() and wscanf in C Library Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report If you are dealing with the wide characters then printf() and scanf() function cannot be used. There are different functions for input and output C wide string. wprintf() : The wprintf() function writes the wide string pointed to by format to stdout. The wide string format may contain format specifiers starting with % which are replaced by the values of variables that are passed to the wprintf() function as additional arguments. Syntax : int wprintf (const wchar_t* format, ...); Parameters : format : A pointer to a null terminated wide string that is written to stdout. It consists of wide characters along with optional format specifiers starting with %. The format specifiers are replaced by the values of respective variables that follows format. … : Other additional arguments specifying the data to be printed. They occur in a sequence according to the format specifier.There should be at least as many of these arguments as the number of values specified in the format specifiers. Additional arguments are ignored by the function. Return Value :If successful, the wprintf() function returns number of characters written. On failure it returns a negative value. If successful, the wprintf() function returns number of characters written. On failure it returns a negative value. // C Program to show the wprintf () function. #include <stdio.h> #include <wchar.h> // Header file containing wprintf function // Driver code int main() { wint_t x = 5; wchar_t name[] = L"GEEKS"; wprintf(L"x = %d \n", x); wprintf(L"HELLO %ls \n", name); return 0; } Output: x = 5 HELLO GEEKS wscanf() : The wscanf() function reads the data from stdin and stores the values into the respective variables. The additional arguments should point to already allocated objects of the type specified by their corresponding format specifier within the format string. Syntax : int wscanf (const wchar_t* format, ...); Parameters : format : Pointer to a null-terminated character string that specifies how to read the input. It consists of format specifiers starting with %. Notice though, that all format specifiers have the same meaning as in scanf; therefore, %lc shall be used to read a wide character (and not %c), as well as %ls shall be used for wide strings (and not %s). … : Other additional arguments for receiving data. They occur in a sequence according to the format specifier.There should be at least as many of these arguments as the number of values stored by the format specifiers. Additional arguments are ignored by the function. Return Value : The wscanf() function returns the number of receiving arguments successfully assigned. We can count and match the expected number of items or be less due to a matching failure, a reading error is occurred, or the reach of the end-of-file causes an error. If failure occurs before the first receiving argument was assigned, EOF is returned. // Program to show the wprintf () function. #include <stdio.h> #include <wchar.h> // Header file containing wscanf() function int main() { wchar_t str[80]; int i; wscanf(L"%ls", str); wscanf(L"%d", &i;); wprintf(L"I am a %ls of CSE in %d year.\n", str, i); return 0; } Input: GEEK 2 Output: I am a GEEK of CSE in 2 year. Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Looking for a place to share your ideas, learn, and connect? Our Community portal is just the spot! Come join us and see what all the buzz is about! Last Updated : 15 Jun, 2022 Like Article Save Article Previous pthread_equal() in C with example Next Generalized Lambda Expressions in C++14 Share your thoughts in the comments Add Your Comment Please Login to comment...