3 ms·
Better try instead of reading standards (and inevitably misreading, or reading differently than compiler authors)... #include <stdio.h> void test(int&
by jstimpfle 9y ago
Better try instead of reading standards (and inevitably misreading, or reading differently than compiler authors)...
#include <stdio.h>
void test(int& x)
{
printf("Hello, world\n"); fflush(stdout);
printf("and the number is: %d\n", x);
}
int main(void)
{
int *x = NULL;
test(*x);
return 0;
}
It's just a syntactic discipline. Null references are undefined in C++, just as NULL dereferences are undefined in C.