.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Articles >> C# >> Post New Resource Bookmark and Share   

 Subscribe to Articles

How C# Differs From C

Posted By:Shashi Ray       Posted Date: February 22, 2009    Points: 10    Category: C#    URL: http://www.dotnetspark.com  

How C# Differs From C


If you have been exposed to C, or if you are an experienced C programmer, you might be interested in the main differences between C# and C:


1. C# does not usually make use of pointers. You can only increment, or decrement a variable as if it were an actual memory pointer inside a special unsafe block.

2. You can declare variables anywhere inside a method you want to; they don't have to be at the beginning of the method.

3. You don't have to declare an object before you use it; you can define it just as you need it.

4. C# has a somewhat different definition of the struct types, and does not support the idea of a union at all.

5. C# has enumerated types, which allow a series of named values, such as colors or day names, to be assigned sequential numbers, but the syntax is rather different.

6. C# does not have bitfields: variables that take up less than a byte of storage.

7. C# does not allow variable length argument lists. You have to define a method for each number and type of argument.


HoweverC# allows for the last argument of a function to be a variable parameter array.


Shashi Ray

 Subscribe to Articles


Further Readings:


    No response found. Be the first to respond this post

    Post Comment

    You must Sign In To post reply
    Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend