Comment

Comment by SV_BubbleTime

> Pointers to Arrays

>In a few places, the original source code contains expressions that point one past the last element of an array. Here is a simplified example of the C code:

    int array[1024];
    int *p;



    if (p >= &array[1024]) {
   
    }
>The C standard (see e.g. C11, Section 6.5.6) allows pointers to an element one past the end of the array.

Wait? Why?

I get that char strings in C are null terminated and that might seem like an off by 1 issue if you aren’t paying attention, you still size your string one larger than your string.

What is this all about?

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton