33
Inbuilt Functions in C++ for Strings π±βπ€
So in this blog post I will be talking about some of the few inbuilt functions in CPP in string (C++)
The function in C++ language is also known as procedure or subroutine in other programming languages.
To perform any task, we can create function. A function can be called many times. It provides modularity and code reusability.
As we all know C++ is a language that has a rich and vast library, some of which are :-
Here in the following image the strlen is the main function that we are using to find out the length of the particular string.
Here in the following image the strcmp is the main function that we are using to compare any two arrays, it takes 2 parameters and compare them if the comparison is equal to 0 then the strings are equal other wise they are not equal.
Here in the following image the strcpy is the main function that we are using to copy the data of one element into another array, it takes 2 parameters and copy the data of the later parameter in the first array.
Here in the following image the strncpy is the main function that we are using to copy some elements of an array into another array, it takes 2 parameters and copy the data of the later parameter in the first array.
Here in the following image the strcat is the main function that we are using to concatenate both of the arrays.
----------------------------------x-------------------------------
33