C vs C#: A Few Similarities


Learning a new programming language can be challenging; different syntax, some are compiled, some are strictly typed while others are loosely typed, and remembering the different built in functions can be difficult. One way to make learning a new language easier is by finding a language with similarities. C and C# are both strictly typed languages and are from the "C family". Some of the similarities they share are data types, if statements, loops, and functions. You can also create arrays and lists in C# without having to worry about memory management like you do with C. Syntactically both C and C# are the same; both end their statements with a semicolon and use curly braces to place their code in. 


Data Types
Some of the data types that C and C# share are int, double, char, and bool. They are also defined syntactically the same:  


If/ Else if /Else Statements
If statements are written the same regardless if you are using C or C#. However, the way you print a line is little different but the rest is the same:



For Loops
For loops are also written the same and can also be nested:






Comments