Advertisement Remove all ads

State Any Two Library Functions String.H Along with Its Syntax, Use an Example. - Structured Programming Approach

State any two library functions string.h along with its syntax, use an example. 

Advertisement Remove all ads

Solution

strlen() function:
1. This function returns an integer value that is the length of the string passed to the function.
2. When returning the length of the string it does not consider the space required for null character.
3. Hence it returns the exact length of the string neglecting the space required for null character.
Syntax: strlen(str)
4. Example: strlen(a); This will find the length of string of a.
strcpy() function:
5. This function copies the second string into the first string passed to the function.

6 The second string remains unchanged. Only the first string is changed and gets a copy of the second string.
Syntax: strcpy(str1,str2)
Example: strcpy(b,a); This will copy the string from a to b.

Concept: Function
  Is there an error in this question or solution?
Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×