none
How to write C Program

    Question

  • Hello there...

    so I have been practicing C program coding on 2008 visual studio community.... However I had no luck finding the same one so i downloaded this 2015 visual studio and I have no idea how to write a normal C program.... I keep getting error for some reason although I am using C# which i think is C platform... (Hopefully). Is there a step which i completely had forgotten to do or something?

    Sunday, July 24, 2016 12:50 PM

Answers

All replies

  • Hi,

    Would you please clarify what you mean by C program? C# or C++?

    Also if you can share with us the error details to help you fix the error.

    If you are using Visual Studio 2015, you can create plenty of projects using C#

    The common was is to create a console application and write your code


    Thanks, Mahmoud

    Sunday, July 24, 2016 1:16 PM
  • Thank you for replying...

    I am using C# but when you write a code you begin by typing (#include <stdio.h>) here I get an error message saying "preprocessor directive epected" also (printf and scanf) an error appears saying "the name does not exist in the current context". 

    Sunday, July 24, 2016 1:34 PM
  • Hi, 

    what are you using #include and printf and scanf  is C language commands not C# commands, and they're also different from C++ commands,

    if you are going to use C# as your programming language, you will definitely need to use its syntax and commands.

    for example #include in C# is  "using" and printf is "Console.WriteLine()" and scanf is "Console.ReadLine()"


    Thanks, Mahmoud

    Sunday, July 24, 2016 1:38 PM
  • oh... then what is the proper software to use... since I have to use #include <stdio.h> 

    Sunday, July 24, 2016 1:46 PM
  • You can create a C++ project in Visual Studio and rename .cpp files .c 

    This will change the file to C language code.

    Check: 

    http://www.swarthmore.edu/NatSci/tali/E15/Visual_C.html

    http://stackoverflow.com/a/20821436/5769970


    Thanks, Mahmoud

    • Marked as answer by shen23 Sunday, July 24, 2016 2:45 PM
    Sunday, July 24, 2016 2:34 PM