Should this work in C++?
C / C++ / MFC
3
Posts
3
Posters
17
Views
1
Watching
-
Should this work in C++?
long add1(a)
long a;
{
return a+1;
}It doesn't seem to compile in Visual Studio. I got it from MIT's OpenCourseware. Thanks.
That is the so called K&R syntax[^]. You can compile as C code but not as C++. The C++ version would be:
long add1 (long a) {
return a+1;
}Mircea
-
Should this work in C++?
long add1(a)
long a;
{
return a+1;
}It doesn't seem to compile in Visual Studio. I got it from MIT's OpenCourseware. Thanks.
mike7411 wrote:
I got it from MIT's OpenCourseware.
I see the MIT is still at the cutting edge of technology !! :rolleyes:
CI/CD = Continuous Impediment/Continuous Despair