Question: 1. (10 pt) Implement a function char unique_chars (char str): which dynamically creates a new string (ns) that will contain the unique characters from the

1. (10 pt) Implement a function char unique_chars (char str): which dynamically creates a new string (ns) that will contain the unique characters from the given string str For example char ns; ns unique chars ("aaaabbbbAAAAAACCCCaaaAAAbbb") ns should be pointing to a dynamically created new string "abAC ns nique_ chars (" abcABCD") ns should be pointing to a dynamically created new string "abcABCD" If needed, you can use standard library functions like strlen, strcpy (dest src), strchr (char s, char ch), which returns NULL if ch is not in s. Allocating large spaces (e.g., as large as str) might be needed temporarily. But, at the end, make sure you allocate just enough space for the new string ns and free temporarily allocated spaces (if any). char unique_chars (char *str) char *ns, tmp_s; int len
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
