strfuncs - :string.h Comparison functions 1 int strcmp(char...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
הירפסהמ תורחבנ תויצקנופ string.h : Comparison functions: 1. int strcmp (char s1[], char s2[]); Compares the contents of s1 and s2. Returns 0 if they are equal; negative of positive value otherwise (depending on the lexicographic order of s1 and s2). 2. int strncmp (char s1[], char s2[], int n); Same as above, but compares only the first n characters of s1 and s2. 3. char* strstr (const char haystack[], const char needle[]); Finds the first occurrence of the substring needle in haystack. The terminating ‘\0’ is not compared. The returned value is a pointer to the beginning of the substring, or NULL if the substring is not found. 4. char* strchr (const char s[], char c); Finds the first occurrence of the character c in s. The returned value is a pointer to the position of c in s, or NULL if it is not found. 5. char* strrchr (const char s[], char c); Finds the last occurrence of the character c in s. The returned value is a pointer to the position of c in s, or NULL if it is not found. Copying functions:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/10/2010 for the course CS 463 taught by Professor Can'tsay during the Spring '09 term at Haaga - Helia University of Applied Sciences.

Page1 / 2

strfuncs - :string.h Comparison functions 1 int strcmp(char...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online