

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!


CptS 121 – Program Design and Development Date Assigned: Fri, Oct 17, 2025 Due Date: Mon, Oct 20, 2025 Take-Home Quiz 7 (15 pts) – Arrays and Strings Using Canvas https://canvas.wsu.edu/, please submit your solution to the correct quiz folder. Your solution should be a .pdf file with the name
two are anagrams; 0 otherwise. Recall: an anagram is a word or phrase that is created by rearranging the symbols in another word or phrase. For example, “silent” and “listen” are anagrams and “mug” and “gum” are anagrams.
alphabetic characters only.
this problem. #include <stdio.h> int is_anagram(char arr1[], int size1, char arr2[], int size2){ if (size1 != size2) return 0; } int count1[26] = {0}; int count2[26] = {0}; for (int i = 0; i < size1; i++) count1[arr1[i] - 'a']++; for (int i = 0; i < size2; i++) Instructor: Andrew S. O’Fallon
CptS 121 – Program Design and Development Date Assigned: Fri, Oct 17, 2025 Due Date: Mon, Oct 20, 2025 count2[arr2[i] - 'a']++; for (int i = 0; i < 26; i++) { if (count1[i] != count2[i]) return 0; } return 1; }
A C string is a sequence of characters stored in memory and terminated by a null character ('\0'). This null character marks the end of the string so that C functions (like printf, strlen, etc.) know where the string stops. Even though C strings are stored in character arrays, not all character arrays are strings—because some might not end with '\0'. Instructor: Andrew S. O’Fallon