I was checking some answer I've seen on stackoverflow and altered a line in a way that shouldn't work according to a very experienced programmer, surprisingly it did. can anyone explain why it is possible? The issue is a character constant with more then one character (i'm using Visual Studio 2013)
// stack.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using std::cout;
int * foo()
{
int a = 5;
return &a;
}
int main()
{
int* p = foo();
cout << *p << ' '; // this line should not compile but it did???
*p = 8;
cout << *p << '\n';
}