Visual Studio and ANSI standard  
Author Message
Michael_P2234





PostPosted: Visual C++ General, Visual Studio and ANSI standard Top

I just got this book Teach Yourself C in 21 Days (which uses ANSI standard) and I can't get Visual C# to even use basic code like:

#include <stdio.h>

main()
{
printf( "Type stuff here" );
}

Although, Visual C++ will, but even then some of the syntax isn't being read as legal code.

How do I get Visual Studio to start using the ANSI standard...




Visual C++5  
 
 
Mike Danes





PostPosted: Visual C++ General, Visual Studio and ANSI standard Top

The ANSI standard is about the C language not about the C# language. You may want to look for a book about C# if you want to learn it.

The equivalent of the above C code in C# is:

using System;

class Program

{

static void Main(string[] args)

{

Console::WriteLine("Type stuff here");

}
}

As for errors with Visual C++ that's because you have put that code in a file with a cpp extensions instead of a c extension. That code is valid C code but it's not valid C++ code.