CS 24000 Lecture Notes - Lecture 4: C Dynamic Memory Allocation, Substring, C String Handling

22 views3 pages

Document Summary

Cs240 lecture 4 notes 01242017 functions and main. String functions in c: c provides string fucntions such as, stry(char *dest, char *src) Copy string src to dest: int strlen(char *s) Return the length of a string: char *strcat(char *dest, char *src) Concatenates string src after string dest. dest should point to a string large enough to have both dest and src and the null terminator: int strcmp(char *a, char *b) Compares to strings a, b. returns >0 is a is larger alphabetically that b, <0 if b is larger than a, or 0 if a and b are equal. String functions in c: char *strstr(const char *haystack, const char *needle), find the first occurrence of the substring needle in the string haystack, returning a pointer to the fund substring. Char strdup(const chars): return a duplicate of the string s in memory allocated using malloc.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents