Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6161283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:27:08+00:00 2026-05-23T21:27:08+00:00

I am on Windows 7 – 64bit, using VS2010. The following code builds in

  • 0

I am on Windows 7 – 64bit, using VS2010. The following code builds in Win32 with no problems and produces the expected outcome (Two matrices of 8 by 8 with all elements having a value of 1 and a third 8 by 8 matrix showing memory addresses).

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

int main(void) {
    int rows, cols, i, x, y;
    int **array_of_pointers, *arr2d;
    rows = 8;
    cols = 8;
    arr2d = (int *) malloc(rows * cols * sizeof(int));
    for(i = 0; i < rows*cols; i++) {
        *(arr2d + i) = 1;
    }

    for(y = 0; y < cols; y++) {
        printf("\n");
        for(x = 0; x < rows; x++) {
            printf("%d ",*(arr2d + y * cols + x));
        }
    }

    array_of_pointers = (int **) malloc(rows * cols * sizeof(int));
    //I want each element of this array_of_pointers to point to the corresponding     element of arr2d
    for(y = 0; y < cols; y++) {
        for(x = 0; x < rows; x++) {
            *(array_of_pointers + y * cols + x) = (arr2d + y * cols + x);
        }
    }

    //now try printing from pointer array
    printf("\n");
    for(y = 0; y < cols; y++) {
        printf("\n");
        for(x = 0; x < rows; x++) {
            printf("%d ",**(array_of_pointers + y * cols + x));
        }
    }

    //now try printing addresses from pointer array
    printf("\n");
    for(y = 0; y < cols; y++) {
        printf("\n");
        for(x = 0; x < rows; x++) {
            printf("%d ",*(array_of_pointers + y * cols + x));
        }
    }

    free(arr2d);
    free(array_of_pointers);

    _getch();
    return 0;
}

However, when trying an x64 build I am presented with the following error message in the output window:

‘test.exe’: Loaded ‘C:\My code\test\x64\Debug\test.exe’, Symbols loaded.

‘test.exe’: Loaded ‘C:\Windows\System32\ntdll.dll’, Cannot find or open the PDB file

‘test.exe’: Loaded ‘C:\Windows\System32\kernel32.dll’, Cannot find or open the PDB file

‘test.exe’: Loaded ‘C:\Windows\System32\KernelBase.dll’, Cannot find or open the PDB file

‘test.exe’: Loaded ‘C:\Windows\System32\msvcr100d.dll’, Symbols loaded.

Critical error detected c0000374
Windows has triggered a breakpoint in test.exe.

This may be due to a corruption of the heap, which indicates a bug in test.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while test.exe has focus.

If I have allocated, used and freed memory correctly for Win32 why would it be different for x64?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:27:08+00:00Added an answer on May 23, 2026 at 9:27 pm

    You’re probably not be allocating enough space for array_of_pointers. You’re using sizeof(int) instead of sizeof(int *). On 64-bit, I’m guessing that int is 32 bits but pointers are 64 bits.

    Additionally, you should be using %p (instead of%d) as the format specifier when printing out the elements of array_of_pointers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Windows Vista - using the following plugins - Codesmith and CodeKeep. I quess it
Windows Phone 7.1/7.5/Mango Silverlight App. Coming from here: Need clarification on using audio on
Windows Form I'm using the DragOver event on a layoutpanel and the DragEventArgs returns
Windows 7 As I'm learning Python (3.2) I prefer using IDLE than CMD. In
Windows API offers InterlockedExchange , which sets a value in memory atomically. Using only
Windows OS defines the following constants as thread priority: THREAD_PRIORITY_IDLE (-15) THREAD_PRIORITY_LOWEST (-2) THREAD_PRIORITY_BELOW_NORMAL
Windows has a feature that allows an administrator to perform auto-logon whenever it is
Windows Forms allows you to develop Components, non-visual elements that can have a designer.
Windows XP Disk Defragmenter report shows a constant gap in disk usage on a
Windows Forms: For System.Drawing there is a way to get the font height. Font

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.