Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started