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 6689497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:31:34+00:00 2026-05-26T05:31:34+00:00

I’m developing a program in C that uses an array of linked lists (a

  • 0

I’m developing a program in C that uses an array of linked lists (a primitive hash table) as a data type to represent certain date information. The array has twelve elements corresponding to the months of the year, and each month has a linked list that contains nodes of data.

I developed the module that used this data type and it worked fine. I later discovered that I was accessing array elements that were out of bounds (for example accessing the 12th element by the index 12 instead of 11). But the program worked consistently without incident. I never received a segmentation fault. I have since corrected the coding error. Could anybody explain why accessing out-of-bounds elements would not result in a segfault?

This is not the first time it has happened. I have created a dynamically allocated multidimensional array, and for the sake of testing, I tried to access out-of-bounds elements. The program ran fine, produced accurate results, and did not seg fault in most circumstances. The only time I achieved one, I had to try accessing substantially out-of-bounds elements.

(These programs currently are windows console applications for testing. I am compiling with MinGW. I can include code, if it would be helpful.)

  • 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-26T05:31:34+00:00Added an answer on May 26, 2026 at 5:31 am

    In C, accessing an array outside its bounds is undefined behavior.

    That means that anything can happen, including the program behaving as you might expect it to.

    The C language doesn’t require bounds checking on array accesses, and most C compilers don’t implement it.

    For example, suppose you declare:

    int before;
    int array[10];
    int after;
    

    The order in which these are stored in memory is undefined, but suppose they’re stored contiguously in the order they’re declared. If you attempt to access array[-1], you might access before instead. If you attempt to access array[10], you might access after instead.

    The burden is on the programmer to avoid accessing arrays outside their bounds.
    Or there might not be anything allocated before and/or after your array.

    An analogy: “The sign says I’m only allowed to cross the street when the light is green. I crossed on red, and nothing happened. Why didn’t a car hit me?” (There are languages that go out of their way to make the car hit you. C isn’t one of them.)

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.