In this version of the problem return a new dynamic array where all repeated let
ID: 3644923 • Letter: I
Question
In this version of the problem return a new dynamic array where all repeated letters are deleted instead of modifying the partially filled array. don't forget to free the memory allocated for these returned dynamic arrays when the data is no longer needed.This program gave a
compiler error; on line 26 the identifier I is undeclared. It seemed
like a mistaken addition so I removed it, but I think there is a
problem with delete_repeats. When you check if each letter is in temp
using isInArray, temp was allocated space but the memory it points to
was never assigned any value. I don't know how to fix it.
#include <iostream>
> using namespace std;
> char *delete_repeats (char letters[], int size);
> bool isInArray(char arr[], int size, char target);
> int main()
> {
> char a[10], * noRepeats = NULL;
> a[0] =
Explanation / Answer
modified your code and its running fine now. you don't need to remove I at line 26 rather change it to for (int i=0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.