
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
strxfrm Function in C/C++
The function strxfrm() transforms the source string to the current locale and copies the first number of characters of transformed string to the destination. It is declared in “locale.h” header file in C language.
Here is the syntax of strxfrm() in C language,
size_t strxfrm(char *destination, const char *source, size_t number)
Here,
destination − The destination pointer where the characters will be copied.
source − The string is to be transformed.
number − The number of characters to be copied.
Here is an example of strxfrm() in C language,
Example
#include <stdio.h> #include <string.h> int main () has { char s[10] = "HelloWorld"; char d[10]; int n; n = strxfrm(d, s, 5); printf("Length of string : %d", n); return(0); }
Output
Length of string : 10
In the above program, two char type arrays are declared. One is the destination and another is source from where the transformed set of characters are copied to the destination. It will copy only “n” characters.
char s[10] = "HelloWorld"; char d[10]; int n; n = strxfrm(d, s, 5);
Advertisements