C++ program produces an exception to?

0

why an error occurs An exception was thrown at address 0x003329B0 in ConsoleApplication1.exe: 0xC0000005: access violation occurred while writing to address 0xCCCCCCCC

#include <iostream>
#include <time.h>
#include <random>
//------------------
using namespace::std;
//------------------
void input(int* size)
{
    cout << "Input pleas size your diapason of array";
    cout << endl;
    cin >> (*size);
};

void randomizer(int** array, int& size)
{
    srand(time(NULL));
    int result = rand() % size;
    result += 1;

    for (int i = 1; i <= result; i++)
    {
        (*array[i]) = rand() % 100;
        if (i % 2)
        {
            (*array[i]) *= -1;
        }
    };
    (*array)[0] = result;
};
//------------------------------------------------------
int ittMOD(int** array)
{
    int result = 0;
    int itt = (*array)[1];
    for (int i(0); i < (*arrey[0]); i++)
    {
        if (itt < 0)
        {
            itt *= -1;
        };
        if (itt < (*array[i]))
        {
            itt = (*array[i]);
            result = i;
        };
        return result;
    };


};


int main()
{
    setlocale(LC_ALL, "RUSSIAN");
    //---------------------------
    int* array = new int;
    int size = 0;
    //---------------------------
    input(&size);
    randomizer(&array, size);
    cout << ittMOD(`&array);
    cout << endl;
    //cout << summELEMENTS(arrey);




    delete array;
    array = NULL;
    return 0;
};
c++
asked on Stack Overflow May 30, 2020 by StenLY • edited May 30, 2020 by Ă”rel

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0