Strlen Strcpy

Strlen Strcpy

Strlen Description The strlen() function shall compute the number of bytes in the string to which s points, not including the terminating null byte. Return value The strlen() function shall return the length of s; the function has no failure mode and no error return. Prototype Declared in string.h size_t strlen(const char *s); Strcpy Prototype Declared in string.h In C90, the prototype is: char *strcpy(char *dest, const char *src); The C99 prototype is identical but adds the new restrict qualifiers: char *strcpy(char * restrict dest, const char * restrict src); Description The strcpy() function shall copy the null-terminated string pointed to by src to the memory pointed to by dest. Source and destination may not overlap. Return value The strcpy() function shall return the pointer dest; the function has no failure mode and no error return. Strcat Description The strcat() function shall append the null-terminated string pointed to by src to the null-terminated string pointed to by dest. The first character of src overwrites the null-terminator of dest. Source and destination may not overlap. Return value The strcat() function shall return the pointer dest; the function has no failure mode and no error return. Prototype Declared in string.h In C90, the prototype is: char *strcat(char *dest, const char *src); Strcmp Description The strcmp() function compares the string pointed to by s1 to the string pointed to by s2. Return value The strcmp() function returns an integer greater than, equal to, or less than zero, accordingly as the string pointed to by s1 is greater than, equal to, or less than the string pointed to by s2. Prototype Declared in string.h The C89/C99 prototype is: int strcmp(const char * s1, const char * s2); Strchr Description The strchr() function locates the first occurrence of c (converted to a char) in the string pointed to by s. The terminating null character is considered to be part of the string. Return value The strchr() function returns a pointer to the located character, or a null pointer if the character does not occur in the string. Prototype Declared in string.h The C89/C99 prototype is: char *strchr(const char *s, int c); .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us