In the code below, when I try to output out_phrase_char, I get a message that says "The Debugger has exited due to signal 10 (SIGBUS).The Debugger has exited due to signal 10 (SIGBUS)." Please help me as soon as possible. This is due at 11:59pm.
// classes example
#include <iostream>
#include <cstdlib>
using namespace std;
class MyClass {
public:
//
int *getNiCount(const char *phrase_char, const wchar_t *phrase_wchar)
{
int index = 0;
int *num_occurences = new int[2];
int main () {
MyClass phrase1;
const char *szTestString1 = "Ni nI NI nI Ni";
const wchar_t *szTestString2 = L"Ni nI NI nI Ni";
char *out_phrase_char = new char[2];
Basically, I am trying to create a function that takes in a const char pointer and a const wchar_t pointer. Then I want to manipulate the const char and const wchar_t strings, either by copying them and manipulating them, or by some other method, and then I want this function to return the new manipulated strings. When trying to do that I keep running into problems with casting, and outputting char pointers versus character strings. Any advice, on how to do this correctly would be greatly appreciated.