Thread: Process terminated with status -1073741510 in Code::Blocks

  1. #1
    Registered User
    Join Date
    Feb 2021
    Posts
    1

    Process terminated with status -1073741510 in Code::Blocks

    Hello people,

    I am pretty new to C and tried programming the quicksort algorithm.
    But Code::Blocks keeps keeps terminating my process with the status above.
    Also when printing my value, it says 6422272 instead of the I did put in.
    Here is my Code:

    Code:
    #include <stdio.h>
    
    
    
    
    void quicksort(int a[], int L, int R) //array, left end, right end
    {
        int i, j, w, x, k;          // i is left index, r is right index, k is pivot
        i = L; j = R;
        k = (L + R) / 2;            // pivot set to middle
        x = a[k];                   // x gets value of k th element
        do
        {
            while(a[i] < x) i = i + 1;
            while(a[j] > x) j = j - 1;
            if(i <= j)
            {
                w = a[i];
                a[i] = a[j];        // swaps values of a[i] and a[j]
                a[j] = w;
                i = i + 1;
                j = j - 1;
            }
        }
        while(i <= j);                          // starts of on right and left side
        if(L < j) quicksort(a, L, j);
        if(R > i) quicksort(a, i, R);
    }
    
    
    int main()
    {
        int length, value, i;
        printf("How long is your array?\n");
        scanf("%d", &length);       // I put 5 in
        printf("%d\n", &length);   // prints 6422272 
        int array[length];
        for(i = 0; i <= length; i++)
        {
            printf("Give value number %d\n", &i);
            scanf("%d", value);        
            array[i] = value;
        }
        quicksort(array, 0, length);
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,533
    > printf("%d\n", &length); // prints 6422272
    Because you don't use & when printing a value.

    > for(i = 0; i <= length; i++)
    Arrays run from 0 to length-1
    So we usually say
    for(i = 0; i < length; i++)

    > printf("Give value number %d\n", &i);
    > scanf("%d", value);
    More goofiness over whether to use & or not.

    Oh, and an explicit return 0; at the end won't go amiss either.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Process terminated with status -11
    By ArakelTheDragon in forum C++ Programming
    Replies: 55
    Last Post: 07-11-2020, 08:44 PM
  2. Replies: 14
    Last Post: 07-06-2016, 01:48 PM
  3. SDL_ttf Process terminated with status 3
    By darpan1118 in forum Game Programming
    Replies: 5
    Last Post: 04-13-2014, 09:35 AM
  4. Process Terminated with status -1073741510
    By Varethien in forum C Programming
    Replies: 5
    Last Post: 08-09-2011, 04:16 AM
  5. Process terminated with status -1073741819
    By smithx in forum C Programming
    Replies: 5
    Last Post: 11-01-2010, 11:13 PM

Tags for this Thread