lecture13 - Last time Chapter 7, Functions Introduction to...

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

View Full Document Right Arrow Icon
Introduction to Low-Level Programming Concepts CMSC 212 ecture 13 1 CMSC 212 Lecture 13 October 13, 2009 Last time Chapter 7, Functions – passing arrays – array and pointer parameters Assembly language and tracing the execution of an assembly-language program example related to Project #2 2 CMSC 212 Chapter 9, Strings, Characters, and Bytes – string basics – the string library function for string length Chapter 9, Strings, Characters, and Bytes, con't. 3 CMSC 212 Copying and appending strings char *strcpy(char *dst, const char *src); – will s= t work? hat about this? char s[9]= "author"; char t[5]= "text"; strcpy(s, t); 4 CMSC 212 – what about this? char *strcat(char *dst, const char *src); strcat(s, "book"); char *s= "author"; char *t= "text"; s= t;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Comparing strings int strcmp(const char *s1, const char *s2); char name[100]; strcmp("cat", "dog") = ? strcmp("cat", "camel") = ? strcmp("cat", "catastophe") = ? 5 CMSC 212 if (strcmp(name, "Mike") == 0 || strcmp(name, "Brandyn") == 0) printf("You seem to be a teaching TA.\n"); else printf("Sorry, you seem to be a loser.\n"); Basic search functions char *strchr(const char *str, int ch); char s[]= "gratification", *p, *q, *r; q= strchr(s, 'i'); if (q != NULL)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

lecture13 - Last time Chapter 7, Functions Introduction to...

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

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