From what I have read, K&R seems to be a good place to start learning programming in general, and C programming specifically. However, I've just started the first chapter and I have a few questions. They may be extremely simple, and I apologize if that's the case (I am new, after all) -- but your helping me answer them would be very appreciated.
1) I understand the book is written to describe C languages in general. Does this mean the examples they give are just rough outlines, and that for me to attempt them myself I have to "translate" the general outline given into C++ or C# or whatever?
For example, the textbook gives this program:
#include <stdio.h>
main()
{
printf("hello, world\n");
}
But I've found a program to print "Hello, world" in C#, for example is:
// A Hello World! program in C#.
using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine("Hello World!");
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
And the program in C++ looks different from both the above...
So my question is: does the book expect me to be able to translate the first program (or outline, whatever it is) to a C# or C++ program -- I am using Visual Studio -- to be able to practice myself?
2) If the book does expect me to do this, do you all have any tips on how I can go about translating general C code to C# or C++.
3) This may be opinion, but which should I base my learning on (and practice coding in) -- C# or C++?