

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Name (printed):
Student ID #:
Section # (or TA’s: name and time)
#include <stdio.h> #include<string.h> int main(){ char a[10]="abc"; char *b; char c[50]="The cat with the hat";
a. [4 pts.] strncpy(a,"Jan",10); printf("%s",a); Jan
b. [4 pts.] b = strrchr(c,’a’); printf("%s %s",a,b); abc t with the hat
c. [4 pts.] strncat(c," is back.",25); printf("%s",c); The cat with the hat is back
d. [4 pts.] c[7]=’\0’; strncat(c," is black.",25); printf("%s",c); The cat is black
int contains(char full[], char list[]){ int listind = 0; while(list[listind] != ’\0’){ if(strchr(full, list[listind]) == NULL){ return 0; } else{ listind++; } } return 1; }