<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6071031058820607247</id><updated>2012-01-02T03:00:08.761-08:00</updated><category term='source: writer Ram yadav'/><category term='Regards---the_awanish'/><category term='PLEASE COMMENT'/><title type='text'>awanish tripathi</title><subtitle type='html'>I keep,I paas, I turn again...

I constantly thirst for knowledge
Rarely taking any umbrage
Keen to help both people and pets
Yes,these are some of my assets</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-569781579178978175</id><published>2011-09-02T23:27:00.000-07:00</published><updated>2011-09-02T23:29:22.517-07:00</updated><title type='text'>HOW TO HIDE OR SHOW DRIVES IN WINDOWS</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;How to hide hard drives in Windows XP/Vista/7&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;If you have sensitive or important data stored on a particular disk drive that you don’t want anyone to see, a great way to hide it is to remove the drive letter assigned to a particular mounted volume. With Windows XP, you can achieve this easily using nothing more than the Command Prompt. Here's how:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;- Click &lt;span style="font-weight:bold;"&gt;Start &gt;&gt; Run&lt;/span&gt; (This brings up the Run dialog box)&lt;br /&gt;- Type &lt;span style="font-weight:bold;"&gt;cmd&lt;/span&gt; and press Enter (This brings up the Windows Command Prompt)&lt;br /&gt;- Type &lt;span style="font-weight:bold;"&gt;diskpart &lt;/span&gt;in the command prompt and press Enter (This launches the Diskpart utility within the Command Prompt window)&lt;br /&gt;- Now type list volume (This displays a list of all mounted volumes on your computer and their associated drive letters)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; for example, you would like to hide drive E, type &lt;span style="font-weight:bold;"&gt;select volume 6&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;- Now type &lt;span style="font-weight:bold;"&gt;remove letter E&lt;/span&gt; (Note: This sometime requires a reboot)&lt;br /&gt;&lt;br /&gt;Diskpart will now remove the drive letter. The drive will no longer be available via Windows Explorer or My Computer.&lt;br /&gt;&lt;br /&gt;Don’t worry though, your data remains safe!&lt;br /&gt;&lt;br /&gt;Now, should you want to unhide the drive and make it accessible again, just repeat the above process. But instead of typing &lt;span style="font-weight:bold;"&gt;remove letter E&lt;/span&gt;, type &lt;span style="font-weight:bold;"&gt;assign letter E&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ref(cyberst0rm.blogspot.com)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-569781579178978175?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/569781579178978175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/09/how-to-hide-or-show-drives-in-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/569781579178978175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/569781579178978175'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/09/how-to-hide-or-show-drives-in-windows.html' title='HOW TO HIDE OR SHOW DRIVES IN WINDOWS'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-8796739478575583641</id><published>2011-02-18T07:43:00.000-08:00</published><updated>2011-02-18T07:45:15.738-08:00</updated><title type='text'>What do you mean by shadowing in .NET?</title><content type='html'>What do you mean by shadowing in .NET?&lt;br /&gt;&lt;br /&gt;Assume that you have a class that derives from the base class and redefines a method in the base class. Then what process is happening? You will generally assume it as overriding meaning that derived class method overrides base class method and redefines the method. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Even when it redefines, the derived class method should have the same signature as base class method and the derived class method should include the keyword override in its method signature.&lt;br /&gt;What if you don’t explicitly specify the override keyword in your derived class method? Even then does it mean as overriding. No, if you don’t explicitly use override then the derived class method is shadowing base class method. This means that derived class is creating a new method that is no way related to the base class method. But the derived class method completely shadows/hides base class method. Unlike overriding, members sharing same name in derived class can have a totally different signature since it is a new member.&lt;br /&gt;&lt;br /&gt;Shadowing happens by default when two members share the same name but override keyword is not mentioned. However you can explicitly perform shadowing using a keyword. &lt;br /&gt;&lt;br /&gt;The keyword differs between languages:&lt;br /&gt;• In C#, shadowing is done by using new modifier&lt;br /&gt;• In VB.NET, shadowing is done using shadows keyword&lt;br /&gt;&lt;br /&gt;Given below are examples to demonstrate shadowing in both the languages.&lt;br /&gt;&lt;br /&gt;Shadowing in C#:&lt;br /&gt;In the following example, method displayMsg of baseClass and data member called member are shadowed by the derived class members using the new modifier: &lt;br /&gt;class baseClass {&lt;br /&gt;public int member;&lt;br /&gt;baseClass(int data) {&lt;br /&gt;member = data;&lt;br /&gt;}&lt;br /&gt;public void displayMsg() {&lt;br /&gt;Console.WriteLine(“In baseClass..”);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;class derivedClass:baseClass {&lt;br /&gt;new public string member;&lt;br /&gt;public derivedClass(string data) {&lt;br /&gt;member = data;&lt;br /&gt;}&lt;br /&gt;new public void displayMsg(string msg) {&lt;br /&gt;Console.WriteLine(“In derivedClass with msg:”+msg);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;class testClass {&lt;br /&gt;baseClass bObj = new baseClass(100);&lt;br /&gt;Console.WriteLine(“Member value of bObj is:” + bObj.member);&lt;br /&gt;bObj.displayMsg();&lt;br /&gt;derivedClass dObj = new derivedClass(“Hello”);&lt;br /&gt;Console.WriteLine(“Member value of dObj is:” + dObj.member);&lt;br /&gt;dObj.displayMsg(“Good Day!”);&lt;br /&gt;}&lt;br /&gt;Output of this code will be:&lt;br /&gt;Member value of bObj is: 100&lt;br /&gt;In baseClass..&lt;br /&gt;Member value of dObj is: Hello&lt;br /&gt;In derivedClass with msg: Good Day!&lt;br /&gt;&lt;br /&gt;In this example, derived class has completely shadowed member and displayMsg of baseClass. Note that the signature of member and displayMsg is different in derivedClass when compared to baseClass. This is acceptable in case of shadowing. But in overriding, it will throw error.&lt;br /&gt;&lt;br /&gt;Shadowing in VB.NET:&lt;br /&gt;In VB.NET, shadowing is done with the help of shadows keyword as demonstrated in the example shown below:&lt;br /&gt;Public Class baseClass&lt;br /&gt;Public member As Integer = 100&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;Public Class derivedClass&lt;br /&gt;Inherits baseClass&lt;br /&gt;Public Shadows member As String = “Hello”&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;Module testModule&lt;br /&gt;Sub Main()&lt;br /&gt;Dim bObj as New baseClass&lt;br /&gt;Dim dObj as New derivedClass&lt;br /&gt;MessageBox.Show(bObj.member)&lt;br /&gt;MessageBox.Show(dObj.member)&lt;br /&gt;End Sub&lt;br /&gt;End Module&lt;br /&gt;&lt;br /&gt;The MessageBox will display 100 first and then Hello.&lt;br /&gt;&lt;br /&gt;Invoking Base Class Member Using Derived Class Object:&lt;br /&gt;So far in the discussion, it was told that the baseClass member is completely hidden in derivedClass. Does that mean you cannot access the baseClass member in derivedClass? No. You still have an option using references. Given below is the modified code of testClass containing code to access baseClass member using derivedClass object:&lt;br /&gt;Module testModule&lt;br /&gt;Sub Main()&lt;br /&gt;Dim dObj As New derivedClass&lt;br /&gt;Dim refBaseClass As baseClass = dObj&lt;br /&gt;MessageBox.Show(&amp;refBaseClass.member)&lt;br /&gt;End Sub&lt;br /&gt;End Module&lt;br /&gt;&lt;br /&gt;Now to your surprise, you will get the output as 100. This is because you create a reference to baseClass which is assigned with derivedClass object. Whatever is the assigned object, the reference takes priority and the baseClass member gets displayed. In this case, shadowing is suppressed.&lt;br /&gt;Reference-dotnet-guide.com&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-8796739478575583641?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/8796739478575583641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/02/what-do-you-mean-by-shadowing-in-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/8796739478575583641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/8796739478575583641'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/02/what-do-you-mean-by-shadowing-in-net.html' title='What do you mean by shadowing in .NET?'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-2014857022213771196</id><published>2011-02-18T05:10:00.000-08:00</published><updated>2011-02-18T05:11:30.013-08:00</updated><title type='text'>SOME INPORTANT DATABASE QUESTION</title><content type='html'>What are two methods of retrieving SQL?&lt;br /&gt;What cursor type do you use to retrieve multiple recordsets?&lt;br /&gt;What is the difference between a "where" clause and a "having" clause? - "Where" is a kind of restiriction statement. You use where clause to restrict all the data from DB.Where clause is using before result retrieving. But Having clause is using after retrieving the data.Having clause is a kind of filtering command.&lt;br /&gt;What is the basic form of a SQL statement to read data out of a table? The basic form to read data out of table is ‘SELECT * FROM table_name; ‘ An answer: ‘SELECT * FROM table_name WHERE xyz= ‘whatever’;’ cannot be called basic form because of WHERE clause.&lt;br /&gt;What structure can you implement for the database to speed up table reads? - Follow the rules of DB tuning we have to: 1] properly use indexes ( different types of indexes) 2] properly locate different DB objects across different tablespaces, files and so on.3] create a special space (tablespace) to locate some of the data with special datatype ( for example CLOB, LOB and …)&lt;br /&gt;What are the tradeoffs with having indexes? - 1. Faster selects, slower updates. 2. Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index.&lt;br /&gt;What is a "join"? - ‘join’ used to connect two or more tables logically with or without common field.&lt;br /&gt;What is "normalization"? "Denormalization"? Why do you sometimes want to denormalize? - Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier. Denormalization means allowing redundancy in a table. The main benefit of denormalization is improved performance with simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing.&lt;br /&gt;What is a "constraint"? - A constraint allows you to apply simple referential integrity checks to a table. There are four primary types of constraints that are currently supported by SQL Server: PRIMARY/UNIQUE - enforces uniqueness of a particular table column. DEFAULT - specifies a default value for a column in case an insert operation does not provide one. FOREIGN KEY - validates that every value in a column exists in a column of another table. CHECK - checks that every value stored in a column is in some specified list. Each type of constraint performs a specific type of action. Default is not a constraint. NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it the only constraint which is not a table level constraint.&lt;br /&gt;What types of index data structures can you have? - An index helps to faster search values in tables. The three most commonly used index-types are: - B-Tree: builds a tree of possible values with a list of row IDs that have the leaf value. Needs a lot of space and is the default index type for most databases. - Bitmap: string of bits for each possible value of the column. Each bit string has one bit for each row. Needs only few space and is very fast.(however, domain of value cannot be large, e.g. SEX(m,f); degree(BS,MS,PHD) - Hash: A hashing algorithm is used to assign a set of characters to represent a text string such as a composite of keys or partial keys, and compresses the underlying data. Takes longer to build and is supported by relatively few databases.&lt;br /&gt;What is a "primary key"? - A PRIMARY INDEX or PRIMARY KEY is something which comes mainly from &lt;br /&gt;database theory. From its behavior is almost the same as an UNIQUE INDEX, i.e. there may only be one of each value in this column. If you call such an INDEX PRIMARY instead of UNIQUE, you say something about &lt;br /&gt;your table design, which I am not able to explain in few words. Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property.&lt;br /&gt;What is a "functional dependency"? How does it relate to database table design? - Functional dependency relates to how one object depends upon the other in the database. for example, procedure/function sp2 may be called by procedure sp1. Then we say that sp1 has functional dependency on sp2.&lt;br /&gt;What is a "trigger"? - Triggers are stored procedures created in order to enforce integrity rules in a database. A trigger is executed every time a data-modification operation occurs (i.e., insert, update or delete). Triggers are executed automatically on occurance of one of the data-modification operations. A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The types of statements are insert,update,delete and query statements. Basically, trigger is a set of SQL statements A trigger is a solution to the restrictions of a constraint. For instance: 1.A database column cannot carry PSEUDO columns as criteria where a trigger can. 2. A database constraint cannot refer old and new values for a row where a trigger can.&lt;br /&gt;Why can a "group by" or "order by" clause be expensive to process? - Processing of "group by" or "order by" clause often requires creation of Temporary tables to process the results of the query. Which depending of the result set can be very expensive.&lt;br /&gt;What is "index covering" of a query? - Index covering means that "Data can be found only using indexes, without touching the tables"&lt;br /&gt;What types of join algorithms can you have?&lt;br /&gt;What is a SQL view? - An output of a query can be stored as a view. View acts like small table which meets our criterion. View is a precomplied SQL query which is used to select data from one or more tables. A view is like a table but it doesn’t physically take any space. View is a good way to present data in a particular format if you use that query quite often. View can also be used to restrict users from accessing the tables directly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-2014857022213771196?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/2014857022213771196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/02/some-inportant-database-question.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/2014857022213771196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/2014857022213771196'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/02/some-inportant-database-question.html' title='SOME INPORTANT DATABASE QUESTION'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-461204729098735415</id><published>2011-01-22T11:48:00.000-08:00</published><updated>2011-01-22T11:51:48.721-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='source: writer Ram yadav'/><title type='text'>भारतीय गणन परंपरा : प्रामाणिक और चमत्कारी</title><content type='html'>ND&lt;br /&gt;क्या यह संभव है कि जिस भारत ने हजारों साल पहले दुनिया को शून्य और दशमलव प्रणाली दी है, उसके पास अपना कोई अलग गणित-ज्ञान न रहा हो? जिन वेदों की गागर में अपने समय के समूचे ज्ञान-विज्ञान का महासागर भरा हो, उस में गणित-ज्ञान नाम की सरिता के लिए स्थान न बचा हो? &lt;br /&gt;&lt;br /&gt;जर्मनी में सबसे कम समय का एक नियमित टेलीविजन कार्यक्रम है 'विसन फोर अख्त।' हिंदी में अर्थ हुआ 'आठ के पहले ज्ञान की बातें'। देश के सबसे बड़े रेडियो और टेलीविजन नेटवर्क एआरडी के इस कार्यक्रम में, हर शाम आठ बजे होने वाले मुख्य समाचारों से ठीक पहले, भारतीय मूल के विज्ञान पत्रकार रंगा योगेश्वर केवल दो मिनटों में ज्ञान-विज्ञान से संबंधित किसी दिलचस्प प्रश्न का सहज-सरल उत्तर देते हैं। ऐसे ही एक कार्यक्रम में रंगा योगेश्वर बता रहे थे कि भारत की क्या अपनी कोई अलग गणित है? वहाँ के लोग क्या किसी दूसरे ढंग से हिसाब लगाते हैं? &lt;br /&gt;&lt;br /&gt;देखिए उदाहरण : &lt;br /&gt;multiply 23 by 12:&lt;br /&gt;&lt;br /&gt;2 3&lt;br /&gt;| × |&lt;br /&gt;1 2&lt;br /&gt;2×1 2×2+3×1 3×2&lt;br /&gt;&lt;br /&gt;2_____7_____6 &lt;br /&gt;&lt;br /&gt;So 23 × 12 = 276 &lt;br /&gt;&lt;br /&gt;भारत में कम ही लोग जानते हैं कि वैदिक गणित नाम का भी कोई गणित है। जो जानते भी हैं, वे इसे विवादास्पद मानते हैं कि वेदों में किसी अलग गणना प्रणाली का उल्लेख है। पर विदेशों में बहुत-से लोग मानने लगे हैं कि भारत की प्राचीन वैदिक विधि से गणित के हिसाब लगाने में न केवल मजा आता है, उससे आत्मविश्वास मिलता है और स्मरणशक्ति भी बढ़ती है। मन ही मन हिसाब लगाने की यह विधि भारत के स्कूलों में शायद ही पढ़ाई जाती है। भारत के शिक्षाशास्त्रियों का अब भी यही विश्वास है कि असली ज्ञान-विज्ञान वही है, जो इंग्लैंड-अमेरिका से आता है। &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ND&lt;br /&gt;घर का जोगी जोगड़ा &lt;br /&gt;घर का जोगी जोगड़ा, आन गाँव का सिद्ध। जबकि सच्चाई यह है कि इंग्लैंड-अमेरिका जैसे आन गाँव वाले भी योगविद्या की तरह ही आज भारतीय वैदिक गणित पर चकित हो रहे हैं और उसे सीख रहे हैं। उसे सिखाने वाली पुस्तकों और स्कूलों की भरमार हो गई है। बिना कागज-पेंसिल या कैल्क्युलेटर के मन ही मन हिसाब लगाने का उससे सरल और तेज तरीका शायद ही कोई है। रंगा योगेश्वर ने जर्मन टेलीविजन दर्शकों को एक उदाहरण से इसे समझायाः&lt;br /&gt;&lt;br /&gt;'मान लें कि हमें 889 में 998 का गुणा करना है। प्रचलित तरीके से यह इतना आसान नहीं है। भारतीय वैदिक तरीके से उसे ऐसे करेंगेः दोनों का सब से नजदीकी पूर्णांक एक हजार है। उन्हें एक हजार में से घटाने पर मिले 2 और 111 । इन दोनों का गुणा करने पर मिलेगा 222 । अपने मन में इसे दाहिनी ओर लिखें। अब 889 में से उस दो को घटाएँ, जो 998 को एक हजार बनाने के लिए जोड़ना पड़ा। मिला 887। इसे मन में 222 के पहले बाईं ओर लिखें। यही, यानी 887 222, सही गुणनफल है।' &lt;br /&gt;&lt;br /&gt;यूनान और मिस्र से भी पुराना &lt;br /&gt;भारत का गणित-ज्ञान यूनान और मिस्र से भी पुराना बताया जाता है। शून्य और दशमलव तो भारत की देन हैं ही, कहते हैं कि यूनानी गणितज्ञ पाइथागोरस का प्रमेय भी भारत में पहले से ज्ञात था। लेकिन, यह ज्ञान समय की धूल के नीचे दबता गया। उसे झाड़-पोंछ कर फिर से निकाला पुरी के शंकराचार्य रहे स्वामी भारती कृष्णतीर्थजी महाराज ने 1911 से 1918 के बीच। वे एक विद्वान पुरुष थे। संस्कृत और दर्शनशास्त्र के अलावा गणित और इतिहास के भी ज्ञाता थे। सात विषयों में मास्टर्स (MA) की डिग्री से विभूषित थे। उन्होंने पुराने ग्रंथों और पांडुलिपियों का मंथन किया और निकाले वे सूत्र, जिन के आधार पर वैदिक विधि से मन ही मन हिसाब लगाये जा सकते हैं।&lt;br /&gt;&lt;br /&gt;16 Sutras + 14 subsutras = 1 Amazingly Fast Calculating System! (एक विज्ञापन) &lt;br /&gt;&lt;br /&gt;विधि के विरोध के आगे विवश &lt;br /&gt;लगता है कि विधि के विधान को भी गणित की वैदिक विधि के विस्तार से कुछ विरोध था। कहा जाता है कि भारती कृष्णतीर्थजी ने वैदिक गणित के 16 मूल सूत्रों की व्याख्या करने वाली 16 पुस्तकों की पांडुलिपियाँ लिखीं थीं, पर वे कहीं गुम हो गईं या नष्ट हो गईं। उन्होंने ये पांडुलिपियाँ अपने एक शिष्य को संभाल कर रखने के लिए दी थीं। उन के खोजे सूत्र अंकगणित ही नहीं, बीजगणित और भूमिति सहित गणित की हर शाखा से संबंधित थे।&lt;br /&gt;&lt;br /&gt;अपने अंतिम दिनों में उन्होंने एक बार फिर यह भगीरथ प्रयास करना चाहा, लेकिन विधि के विधान ने एक बार फिर टाँग अड़ा दी। वे केवल एक ही सूत्र पर दुबारा लिख पाए। उन्होंने जो कुछ लिखा था और उनके शिष्यों ने उनसे जो सीखा- सुना था, उसी के संकलन के आधार पर 1965 में वैदिक गणित नाम से एक पुस्तक प्रकाशित होने वाली थी। प्रकाशन से पहले ही बीमारी के कारण उनका जीवनकाल (1884 से 1960) पूरा हो चुका था।&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ND&lt;br /&gt;पश्चिम की बढ़ती दिलचस्पी &lt;br /&gt;1960 वाले दशक के अंतिम दिनों में वैदिक गणित की एक प्रति जब लंदन पहुँची, तो इंग्लैंड के जाने-माने गणितज्ञ भी चकित रह गये। उन्होंने उस पर टिप्पणियाँ लिखीं और व्याख्यान दिए। जिन्हें 1981 में पुस्तकाकार प्रकाशित किया गया। यहीं से शुरू होता है पश्चिमी देशों में वैदिक गणित का मान-सम्मान और प्रचार-प्रसार। &lt;br /&gt;&lt;br /&gt;कुछ साल पहले लंदन के सेंट जेम्स स्कूल ने अपने यहाँ वैदिक गणित की पढ़ाई शुरू की। आज उसे भारत से अधिक इंग्लैंड, अमेरिका, कनाडा और ऑस्ट्रेलिया जैसे देशों के सरकारी और निजी स्कूलों में पढ़ाया जाता है। शिक्षक गणित को रोचक और सरल बनाने के लिए उसका सहारा लेते हैं। वैदिक विधि से बड़ी संख्याओं का जोड़-घटाना और गुणा-भाग ही नहीं, वर्ग और वर्गमूल, घन और घनमूल निकालना भी संभव है। &lt;br /&gt;&lt;br /&gt;नासा की जिज्ञासा &lt;br /&gt;ऑस्ट्रेलिया के कॉलिन निकोलस साद वैदिक गणित के भक्त हैं। उन्होंने अपना उपनाम 'जैन' रख लिया है और ऑस्ट्रेलिया के न्यू साउथ वेल्स प्रांत में बच्चों को वैदिक गणित सिखाते हैं। उनका दावा हैः 'अमेरिकी अंतरिक्ष अधिकरण नासा गोपनीय तरीके से वैदिक गणित का कृत्रिम बुद्धिमत्ता वाले रोबोट बनाने में उपयोग कर रहा है। नासा वाले समझना चाहते हैं कि रोबोट में आदमी के दिमाग की नकल कैसे की जा सकती है ताकि रोबोट ही दिमाग की तरह हिसाब भी लगा सके-- उदाहरण के लिए कि 96 गुणा 95 कितना हुआ....9120।' &lt;br /&gt;&lt;br /&gt;कॉलिन निकोलस साद ने वैदिक गणित पर किताबें भी लिखी हैं। बताते हैं कि वैदिक गणित कम से कम ढाई से तीन हजार साल पुराना विज्ञान है। उस में मन ही मन हिसाब लगाने के जो16 सूत्र बताए गए हैं, वे इस विधि का उपयोग करने वाले की स्मरणशक्ति भी बढ़ाते हैं। &lt;br /&gt;&lt;br /&gt;चमकदार प्राचीन विद्या &lt;br /&gt;साद अपने बारे में कहते हैं, 'मेरा काम अंकों की इस चमकदार प्राचीन विद्या के प्रति बच्चों में प्रेम जगाना है। मेरा मानना है कि बच्चों को सचमुच वैदिक गणित सीखना चाहिए। भारतीय योगियों ने उसे हजारों साल पहले विकसित किया था। आप उनसे गणित का कोई भी प्रश्न पूछ सकते थे और वे मन की कल्पनाशक्ति से देख कर फट से जवाब दे सकते थे। उन्होंने तीन हजार साल पहले शून्य की अवधारणा प्रस्तुत की और दशमलव वाला बिंदु सुझाया। उनके बिना आज हमारे पास कंप्यूटर नहीं होता।' &lt;br /&gt;&lt;br /&gt;साद उर्फ जैन ने मानो वैदिक गणित के प्रचार-प्रसार का व्रत ले रखा है,' मैं पिछले 25 सालों से लोगों को बता रहा हूँ कि आप अपने बच्चों के लिए सबसे अच्छा काम यही कर सकते हैं कि उन्हें वैदिक गणित सिखाएँ। इससे आत्मविश्वास, स्मरणशक्ति और कल्पनाशक्ति बढ़ती है। इस गणित के 16 मूल सूत्र जानने के बाद&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-461204729098735415?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/461204729098735415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/461204729098735415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/461204729098735415'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/blog-post.html' title='भारतीय गणन परंपरा : प्रामाणिक और चमत्कारी'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-727434298250664138</id><published>2011-01-20T09:24:00.000-08:00</published><updated>2011-01-20T09:27:09.887-08:00</updated><title type='text'>C Vs C++</title><content type='html'>&lt;span style="font-style:italic;"&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Incompatibilities Between&lt;/span&gt; &lt;br /&gt;C and C++&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Contents&lt;br /&gt;&lt;br /&gt;Introduction&lt;br /&gt;C++ versus C&lt;br /&gt;Changes to C99 versus C++98&lt;br /&gt;Aggregate Initializers&lt;br /&gt;Comments&lt;br /&gt;Conditional expression declarations&lt;br /&gt;Digraph punctuation tokens&lt;br /&gt;Implicit function declarations&lt;br /&gt;Implicit variable declarations&lt;br /&gt;Intermixed declarations and statements&lt;br /&gt;C99 versus C++98&lt;br /&gt;Alternate punctuation token spellings&lt;br /&gt;Array parameter qualifiers&lt;br /&gt;Boolean type&lt;br /&gt;Character literals&lt;br /&gt;clog identifier&lt;br /&gt;Comma operator results&lt;br /&gt;Complex floating-point type&lt;br /&gt;Compound literals&lt;br /&gt;const linkage&lt;br /&gt;Designated initializers&lt;br /&gt;Duplicate typedefs&lt;br /&gt;Dynamic sizeof evaluation&lt;br /&gt;Empty parameter lists&lt;br /&gt;Empty preprocessor function macro arguments&lt;br /&gt;Enumeration constants&lt;br /&gt;Enumeration declarations with trailing comma&lt;br /&gt;Enumeration types&lt;br /&gt;Flexible array members&lt;br /&gt;Function name mangling&lt;br /&gt;Function pointers&lt;br /&gt;Hexadecimal floating-point literals&lt;br /&gt;IEC 60559 arithmetic support&lt;br /&gt;Inline functions&lt;br /&gt;Integer types headers&lt;br /&gt;Library function prototypes&lt;br /&gt;Library header files&lt;br /&gt;long long integer type&lt;br /&gt;Nested structure tags&lt;br /&gt;Non-prototype function declarations&lt;br /&gt;Old-style casts&lt;br /&gt;One definition rule&lt;br /&gt;_Pragma keyword&lt;br /&gt;Predefined identifiers&lt;br /&gt;Reserved keywords in C99&lt;br /&gt;Reserved keywords in C++&lt;br /&gt;restrict keyword&lt;br /&gt;Returning void&lt;br /&gt;static linkage&lt;br /&gt;String initializers&lt;br /&gt;String literals are const&lt;br /&gt;Structures declared in function prototypes&lt;br /&gt;Type-generic math functions&lt;br /&gt;Typedefs versus type tags&lt;br /&gt;Variable-argument function declarators&lt;br /&gt;Variable-argument preprocessor function macros&lt;br /&gt;Variable-length arrays&lt;br /&gt;Void pointer assignments&lt;br /&gt;Wide character type&lt;br /&gt;References&lt;br /&gt;Acknowledgments&lt;br /&gt;Revision History&lt;br /&gt;Bottom&lt;br /&gt;&lt;br /&gt;Introduction&lt;br /&gt;&lt;br /&gt;The C programming language began to be standardized some time around 1985 by the ANSI X3J9 committee. Several years of effort went by, and in 1989 ANSI approved the new standard. An ISO committee ratified it a year later in 1990 after adding an amendment dealing with internationalization issues. The 1989 C standard is known officially as ANSI/ISO 9899-1989, Programming Languages - C, and this document refers to the 1989 C standard as C89. The 1990 ISO revision of the standard is known officially as ISO/IEC 9899-1990, Programming Languages - C, which is referred to in this document as "C90".&lt;br /&gt;&lt;br /&gt;The next version of the C standard was ratified by ISO in 1999. Officially know as ISO/IEC 9899-1999, Programming Languages - C, it is referred to in this document as "C99".&lt;br /&gt;&lt;br /&gt;The C++ programming language was based on the C programming language as it existed shortly after the ANSI C standardization effort had begun. Around 1995 an ISO committee was formed to standardize C++, and the new standard was ratified in 1998, which is officially known as ISO/IEC 14882-1998, Programming Languages - C++. It is referred to in this document as "C++98" or simply as "C++".&lt;br /&gt;&lt;br /&gt;Though the two languages share a common heritage, and though the designers involved in the standardization processes for each language tried to keep them as compatible as possible, some incompatibilities unavoidably arose. Once the programmer is aware of these potential problem spots, they are easy, for the most part, to avoid when writing C code.&lt;br /&gt;&lt;br /&gt;When we say that C is incompatible with C++ with respect to a specific language feature, we mean that a C program that employs that feature either is not valid C++ code and thus will not compile as a C++ program, or that it will compile as a C++ program but will exhibit different behavior than the same program compiled as a C program. In other words, an incompatible C feature is valid as C code but not as C++ code. All incompatibilities of this kind are addressed in this document. Avoiding these kinds of incompatibilities allows the programmer to write correct C code that is intended to interact with, or be compiled as, C++ code.&lt;br /&gt;&lt;br /&gt;Another form of incompatible feature is one that is valid when used in a C++ program but is invalid in a C program. We call this an incompatible C++ feature. Huge portions of the C++ language fall into this category (e.g., classes, templates, exceptions, references, member functions, anonymous unions, etc.), so very few of these kinds of incompatibilities are addressed in this document.&lt;br /&gt;&lt;br /&gt;Yet another form of incompatible feature occurs when a C++ program uses a feature that has the same name as a C90 feature but which has a different usage or meaning in C. This document covers these kinds of incompatibilities.&lt;br /&gt;&lt;br /&gt;This document lists only the incompatibilities between C99 and C++98. (Incompatibilities between C90 and C++ have been documented elsewhere; see Appendix B of Stroustrup [STR], for example.)&lt;br /&gt;&lt;br /&gt;New additions to the C99 standard library are also not addressed in this document unless they specifically introduce C++ incompatibilities. &lt;br /&gt;C++ versus C&lt;br /&gt;&lt;br /&gt;As discussed in the Introduction, no attempt is made in this document to cover incompatible C++ features, i.e., features of the C++ language or library that are not supported in C. Huge portions of C++ and its library fall into this category. A partial list of these features includes:&lt;br /&gt;&lt;br /&gt;anonymous unions&lt;br /&gt;classes&lt;br /&gt;constructors and destructors&lt;br /&gt;exceptions and try/catch blocks&lt;br /&gt;external function linkages (e.g., extern "C")&lt;br /&gt;function overloading&lt;br /&gt;member functions&lt;br /&gt;namespaces&lt;br /&gt;new and delete operators and functions&lt;br /&gt;operator overloading&lt;br /&gt;reference types&lt;br /&gt;standard template library (STL)&lt;br /&gt;template classes&lt;br /&gt;template functions&lt;br /&gt;&lt;br /&gt;Changes to C99 versus C++98&lt;br /&gt;&lt;br /&gt;The following items are incompatibilities between C90 and C++98, but have since been changed in C99 so that they no longer cause problems between the two languages.&lt;br /&gt;&lt;br /&gt;Aggregate Initializers&lt;br /&gt;C90 requires automatic and register variables of aggregate type (struct, array, or union) to have initializers containing only constant expressions. (Many compilers do not adhere to this restriction, however.)&lt;br /&gt;&lt;br /&gt;C99 removes that restriction, allowing non-constant expressions to be used in such initializers.&lt;br /&gt;&lt;br /&gt;C++ allows non-constant expressions to be used in initializers for automatic and register variables. (It also allows arbitrary non-constant expressions to be used to initialize static and external variables.)&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;    // C and C++ code&lt;br /&gt;    void foo(int i)&lt;br /&gt;    {&lt;br /&gt;        float   x = (float)i;           // Valid C90, C99, and C++&lt;br /&gt;        int     m[3] = { 1, 2, 3 };     // Valid C90, C99, and C++&lt;br /&gt;        int     g[2] = { 0, i };        // Invalid C90&lt;br /&gt;    } &lt;br /&gt;[C99: §6.7.8] &lt;br /&gt;[C++98: §3.7.2, 8.5, 8.5.1]&lt;br /&gt;&lt;br /&gt;Comments&lt;br /&gt;C++ recognizes //... comments as well as /*...*/ comments.&lt;br /&gt;&lt;br /&gt;C90 only recognizes the /*...*/ form of comments. The //... form usually produces a syntax error in C90, but there are rare cases that may compile erroneously without warning:&lt;br /&gt;&lt;br /&gt;     i = (x//*y*/z++&lt;br /&gt;           , w); &lt;br /&gt;C99 recognizes both forms of comments.&lt;br /&gt;&lt;br /&gt;[C99: §5.1.1.2, 6.4.9] &lt;br /&gt;[C++98: §2.1, 2.7]&lt;br /&gt;&lt;br /&gt;Conditional expression declarations&lt;br /&gt;C++ allows local variable declarations within conditional expressions (which appear within for, if, while, and switch statements). The scope of the variables declared in this context extends to the end of the statement containing the conditional expression. For example:&lt;br /&gt;&lt;br /&gt;    for (int i = 0; i &lt; SIZE; i++)&lt;br /&gt;        a[i] = i + 1; &lt;br /&gt;C90 does not allow this feature.&lt;br /&gt;&lt;br /&gt;C99 allows this feature, but only within for statements.&lt;br /&gt;&lt;br /&gt;[C99: §6.8.5] &lt;br /&gt;[C++98: §3.3.2, 6.4, 6.5]&lt;br /&gt;&lt;br /&gt;Digraph punctuation tokens&lt;br /&gt;C++ recognizes two-character punctuation tokens, called digraphs, which are not recognized by C90. The digraphs and their equivalent tokens are:&lt;br /&gt;&lt;br /&gt;&lt;: [&lt;br /&gt;:&gt; ]&lt;br /&gt;&lt;% {&lt;br /&gt;%&gt; }&lt;br /&gt;%: #&lt;br /&gt;%:%: ##&lt;br /&gt;C99 recognizes the same set of digraphs.&lt;br /&gt;&lt;br /&gt;The following program is valid in both C99 and C++:&lt;br /&gt;&lt;br /&gt;    %:include &lt;stdio.h&gt;&lt;br /&gt;&lt;br /&gt;    %:ifndef BUFSIZE&lt;br /&gt;     %:define BUFSIZE  512&lt;br /&gt;    %:endif&lt;br /&gt;&lt;br /&gt;    void copy(char d&lt;::&gt;, const char s&lt;::&gt;, int len)&lt;br /&gt;    &lt;%&lt;br /&gt;        while (len-- &gt;= 0)&lt;br /&gt;        &lt;%&lt;br /&gt;            d&lt;:len:&gt; = s&lt;:len:&gt;;&lt;br /&gt;        %&gt;&lt;br /&gt;    %&gt; &lt;br /&gt;[C99: §6.4.6] &lt;br /&gt;[C++98: §2.5, 2.12]&lt;br /&gt;&lt;br /&gt;Implicit function declarations&lt;br /&gt;C90 allows a function to be implicitly declared at the point of its first use (call), assigning it a return type of int by default. For example:&lt;br /&gt;&lt;br /&gt;    /* No previous declaration of bar() is in scope */&lt;br /&gt;&lt;br /&gt;    void foo(void)&lt;br /&gt;    {&lt;br /&gt;        bar();  /* Implicit declaration: extern int bar() */&lt;br /&gt;    } &lt;br /&gt;C++ does not allow implicit function declarations. It is invalid to call a function that does not have a previous declaration in scope.&lt;br /&gt;&lt;br /&gt;C99 no longer allows functions to be implicitly declared. The code above is invalid in both C99 and C++.&lt;br /&gt;&lt;br /&gt;[C99: §6.5.2.2] &lt;br /&gt;[C++98: §5.2.2]&lt;br /&gt;&lt;br /&gt;Implicit variable declarations&lt;br /&gt;C90 allows the declaration of a variable, function argument, or structure member to omit the type specifier, implicitly defaulting its type to int.&lt;br /&gt;&lt;br /&gt;C99 does not allow this omission, and neither does C++.&lt;br /&gt;&lt;br /&gt;The following code is valid in C90, but invalid in C99 and C++:&lt;br /&gt;&lt;br /&gt;    static  sizes = 0;         /* Implicit int, error */&lt;br /&gt;&lt;br /&gt;    struct info&lt;br /&gt;    {&lt;br /&gt;        const char *  name;&lt;br /&gt;        const         sz;      /* Implicit int, error */&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    static foo(register i)     /* Implicit ints, error */&lt;br /&gt;    {&lt;br /&gt;        auto  j = 3;           /* Implicit int, error */&lt;br /&gt;&lt;br /&gt;        return (i + j);&lt;br /&gt;    } &lt;br /&gt;[C99: §6.7, 6.7.2] &lt;br /&gt;[C++98: §7, 7.1.5]&lt;br /&gt;&lt;br /&gt;Intermixed declarations and statements&lt;br /&gt;C90 syntax specifies that all the declarations within a block must appear before the first statement in the block.&lt;br /&gt;&lt;br /&gt;C++ does not have this restriction, allowing statements and declarations to appear in any order within a block.&lt;br /&gt;&lt;br /&gt;C99 also removes this restriction, allowing intermixed statements and declarations.&lt;br /&gt;&lt;br /&gt;    void prefind(void)&lt;br /&gt;    {&lt;br /&gt;        int     i;&lt;br /&gt;&lt;br /&gt;        for (i = 0; i &lt; SZ; i++)&lt;br /&gt;            if (find(arr[i]))&lt;br /&gt;                break;&lt;br /&gt;&lt;br /&gt;        const char *  s;   /* Invalid C90, valid C99 and C++ */&lt;br /&gt;&lt;br /&gt;        s = arr[i];&lt;br /&gt;        prepend(s);&lt;br /&gt;    } &lt;br /&gt;[C99: §6.8.2] &lt;br /&gt;[C++98: §6, 6.3, 6.7]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C99 versus C++98&lt;br /&gt;&lt;br /&gt;The following items comprise the differences between C99 and C++98. Some of these incompatibilities existed between C89 and C++98 and remain unchanged between C99 and C++98, while others are new features that were introduced into C99 that are incompatible with C++98.&lt;br /&gt;&lt;br /&gt;Note that features that are specific to C++ and which are not legal C (e.g., class member function declarations) are not included in this section; only language features that are common to both C and C++ are discussed. Most of the features are valid as C but invalid as C++.&lt;br /&gt;&lt;br /&gt;Some of these features are likely to be implemented as extensions by many C++ compilers in order to be more compatible with C compilers.&lt;br /&gt;&lt;br /&gt;Alternate punctuation token spellings&lt;br /&gt;C++ provides the following keywords as synonyms for punctuation tokens:&lt;br /&gt;&lt;br /&gt;and &amp;&amp;&lt;br /&gt;and_eq &amp;=&lt;br /&gt;bitand &amp;&lt;br /&gt;bitor |&lt;br /&gt;compl ~&lt;br /&gt;not !&lt;br /&gt;not_eq !=&lt;br /&gt;or ||&lt;br /&gt;or_eq |=&lt;br /&gt;xor ^&lt;br /&gt;xor_eq ^=&lt;br /&gt;These keywords are also recognized by the C++ preprocessor.&lt;br /&gt;&lt;br /&gt;C90 does not have these built-in keywords, but it does provide a standard &lt;iso646.h&gt; header file that contains definitions for the same words as macros, behaving almost like built-in keywords.&lt;br /&gt;&lt;br /&gt;C++ requires implementations to provide an empty &lt;iso646.h&gt; header. Including it in a C++ program has no effect on the program. However, C code that does not include the &lt;iso646.h&gt; header is free to use these words as identifiers and macro names, which may cause incompatibilities when such code is compiled as C++.&lt;br /&gt;&lt;br /&gt;    enum oper { nop, and, or, eq, ne };&lt;br /&gt;&lt;br /&gt;    extern int  instr(enum oper op, struct compl *c); &lt;br /&gt;The recommended practice for code intended to be compiled as both C and C++ is to use these identifiers only for these special meanings, and only after including &lt;iso646.h&gt;.&lt;br /&gt;&lt;br /&gt;    // Proper header inclusion allows for the use of 'and' et al&lt;br /&gt;&lt;br /&gt;    #ifndef __cplusplus&lt;br /&gt;     #include &lt;iso646.h&gt;&lt;br /&gt;    #endif&lt;br /&gt;&lt;br /&gt;    int foo(float a, float b, float c)&lt;br /&gt;    {&lt;br /&gt;        return (a &gt; b  and  b &lt;= c);&lt;br /&gt;    } &lt;br /&gt;[C99: §7.9] &lt;br /&gt;[C++98: §2.5, 2.11]&lt;br /&gt;&lt;br /&gt;Array parameter qualifiers&lt;br /&gt;C99 provides new declaration syntax for function parameters of array types, allowing type qualifiers (the cv-qualifiers const and volatile, and restrict) to be included within the first set of brackets of an array declarator. The qualifier modifies the type of the array parameter itself. For example, the following declarations are semantically identical:&lt;br /&gt;&lt;br /&gt;    extern void  foo(int str[const]);&lt;br /&gt;    extern void  foo(int *const str); &lt;br /&gt;In both declarations, parameter str is a const pointer to an int object.&lt;br /&gt;&lt;br /&gt;C99 also allows the static specifier to be placed within the brackets of an array declaration immediately preceding the expression specifying the size of the array. The presence of such a specifer indicates that the array is composed of at least the number of contiguous elements indicated by the size expression. (Presumably this is a hint to the compiler for optimizing access to elements of the array.) For example:&lt;br /&gt;&lt;br /&gt;    void baz(char s[static 10])&lt;br /&gt;    {&lt;br /&gt;        // s[0] thru s[9] exist and are contiguous&lt;br /&gt;        ...&lt;br /&gt;    } &lt;br /&gt;None of these new syntactic features are recognized by C++.&lt;br /&gt;&lt;br /&gt;(These features might be provided as an extension by some C++ compilers.)&lt;br /&gt;&lt;br /&gt;[C99: §6.7.5, 6.7.5.2, 6.7.5.3] &lt;br /&gt;[C++98: §7.1.1, 7.1.5.1, 8.3.4, 8.3.5, 8.4]&lt;br /&gt;&lt;br /&gt;Boolean type&lt;br /&gt;C99 supports the _Bool keyword, which declares a two-valued integer type (capable of representing the values true and false). It also provides a standard &lt;stdbool.h&gt; header that contains definitions for the following macros:&lt;br /&gt;&lt;br /&gt;bool Same as _Bool&lt;br /&gt;false Equal to (_Bool)0&lt;br /&gt;true Equal to (_Bool)1&lt;br /&gt;C++ provides bool, false, and true as reserved keywords and implements bool as a true built-in boolean type.&lt;br /&gt;&lt;br /&gt;C programs that do not include the &lt;stdbool.h&gt; header are free to use these keywords as identifiers and macro names, which may cause compatibility problems when such code is compiled as C++. For example:&lt;br /&gt;&lt;br /&gt;    typedef short   bool;       // Different&lt;br /&gt;&lt;br /&gt;    #define false   ('\0')      // Different&lt;br /&gt;    #define true    (!false)    // Different&lt;br /&gt;&lt;br /&gt;    bool  flag =    false; &lt;br /&gt;The recommended practice is therefore to use these identifiers in C only for these special meanings, and only after including &lt;stdbool.h&gt;.&lt;br /&gt;&lt;br /&gt;(It is likely that an empty &lt;stdbool.h&gt; header will be provided by most C++ implementations as an extension.)&lt;br /&gt;&lt;br /&gt;[C99: §6.2.5, 6.3.1.1, 6.3.1.2, 7.16, 7.26.7] &lt;br /&gt;[C++98: §2.11, 2.13.5, 3.9.1]&lt;br /&gt;&lt;br /&gt;Character literals&lt;br /&gt;In C, character literals such as 'a' have type int, and thus sizeof('a') is equal to sizeof(int).&lt;br /&gt;&lt;br /&gt;In C++, character literals have type char, and thus sizeof('a') is equal to sizeof(char).&lt;br /&gt;&lt;br /&gt;This difference can lead to inconsistent behavior in some code that is compiled as both C and C++.&lt;br /&gt;&lt;br /&gt;    memset(&amp;i, 'a', sizeof('a'));   // Questionable code &lt;br /&gt;In practice, this is probably not much of a problem, since character constants are implicitly converted to type int when they appear within expressions in both C and C++.&lt;br /&gt;&lt;br /&gt;[C99: §6.4.4.4] &lt;br /&gt;[C++98: §2.13.2]&lt;br /&gt;&lt;br /&gt;clog identifier&lt;br /&gt;C99 declares clog() in &lt;math.h&gt; as the complex natural logarithm function.&lt;br /&gt;&lt;br /&gt;C++ declares std::clog in &lt;iostream&gt; as the name of the standard error logging output stream (analogous to the stderr stream). This name is placed into the global namespace if the &lt;math.h&gt; header is included, and refers to the logarithm function. If &lt;math.h&gt; defines clog as a preprocessor macro name, it can cause problems with other C++ code.&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;&lt;br /&gt;    #include &lt;iostream&gt;&lt;br /&gt;    using std::clog;&lt;br /&gt;&lt;br /&gt;    #include &lt;math.h&gt;               // Possible conflict&lt;br /&gt;&lt;br /&gt;    void foo(void)&lt;br /&gt;    {&lt;br /&gt;        clog &lt;&lt; clog(2.718281828) &lt;&lt; endl;&lt;br /&gt;                                    // Possible conflict&lt;br /&gt;    } &lt;br /&gt;Including both the &lt;iostream&gt; and the &lt;cmath&gt; headers in C++ code places both clog names into the std:: namespace, one being a variable and the other being a function, which should not cause any conflicts.&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;&lt;br /&gt;    #include &lt;iostream&gt;&lt;br /&gt;    #include &lt;cmath&gt;&lt;br /&gt;&lt;br /&gt;    void foo(void)&lt;br /&gt;    {&lt;br /&gt;        std::clog &lt;&lt; std::clog(2.718281828) &lt;&lt; endl;&lt;br /&gt;                                    // No conflict; different types&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void bar(void)&lt;br /&gt;    {&lt;br /&gt;        complex double  (* fp)(complex double);&lt;br /&gt;&lt;br /&gt;        fp = &amp;std::clog;            // Unambiguous&lt;br /&gt;    } &lt;br /&gt;It would appear that the safest approach to this potential conflict would be to avoid using both forms of clog within the same source file.&lt;br /&gt;&lt;br /&gt;[C99: §7.3.7.2] &lt;br /&gt;[C++98: §27.3.1]&lt;br /&gt;&lt;br /&gt;Comma operator results&lt;br /&gt;The comma operator in C always results in an r-value even if its right operand is an l-value, while in C++ the comma operator will result in an l-value if its right operand is an l-value. This means that certain expressions are valid in C++ but not in C:&lt;br /&gt;&lt;br /&gt;    int     i;&lt;br /&gt;    int     j;&lt;br /&gt;&lt;br /&gt;    (i, j) = 1;     // Valid C++, invalid C &lt;br /&gt;[C99: §6.5.3.4, 6.5.17] &lt;br /&gt;[C++98: §5.3.3, 5.18]&lt;br /&gt;&lt;br /&gt;Complex floating-point type&lt;br /&gt;C99 provides built-in complex and imaginary floating point types, which are declared using the _Complex and _Imaginary keywords.&lt;br /&gt;&lt;br /&gt;There are exactly three complex types and three imaginary types in C99:&lt;br /&gt;&lt;br /&gt;_Complex float&lt;br /&gt;_Complex double&lt;br /&gt;_Complex long double&lt;br /&gt;&lt;br /&gt;_Imaginary long double&lt;br /&gt;_Imaginary double&lt;br /&gt;_Imaginary long double&lt;br /&gt;C99 also provides a standard &lt;complex.h&gt; header that contains definitions of complex floating point types, macros, and constants. In particular, this header defines the following macros:&lt;br /&gt;&lt;br /&gt;complex Same as _Complex&lt;br /&gt;imaginary Same as _Imaginary&lt;br /&gt;I i  (the complex identity)&lt;br /&gt;C code that does not include this header is free to use these words as identifiers and macro names. This was an intentional part of the design of the _Complex and _Imaginary keywords, since this allows existing code that employs the new words to continue working as it did before under C89.&lt;br /&gt;&lt;br /&gt;Implicit widening conversions between the complex and imaginary types are provided, which parallel the implicit widening conversions between the non-complex floating point types.&lt;br /&gt;&lt;br /&gt;    // C99 code&lt;br /&gt;&lt;br /&gt;    #include &lt;complex.h&gt;&lt;br /&gt;&lt;br /&gt;    complex double square_d(complex double a)&lt;br /&gt;    {&lt;br /&gt;        return (a * a);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    complex float square_f(complex float a)&lt;br /&gt;    {&lt;br /&gt;        complex double  d = a;      // Implicit conversion&lt;br /&gt;&lt;br /&gt;        return square_d(a);         // Implicit conversion&lt;br /&gt;    } &lt;br /&gt;C++ provides a template class named complex, declared in the &lt;complex&gt; standard header file. This type is incompatible with the C99 complex types.&lt;br /&gt;&lt;br /&gt;C++ supports more complex types than C99, in theory, since complex is a template class.&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;&lt;br /&gt;    #include &lt;complex&gt;&lt;br /&gt;&lt;br /&gt;    complex&lt;float&gt; square(complex&lt;float&gt; a)&lt;br /&gt;    {&lt;br /&gt;        return (a * a);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    complex&lt;int&gt; square(complex&lt;int&gt; a)&lt;br /&gt;    {&lt;br /&gt;        return (a * a);&lt;br /&gt;    } &lt;br /&gt;It is possible to define typedefs that will work in both C99 and C++, albeit with some limitations:&lt;br /&gt;&lt;br /&gt;    #ifdef __cplusplus&lt;br /&gt;&lt;br /&gt;     #include &lt;complex&gt;&lt;br /&gt;&lt;br /&gt;     typedef complex&lt;float&gt;           complex_float;&lt;br /&gt;     typedef complex&lt;double&gt;          complex_double;&lt;br /&gt;     typedef complex&lt;long double&gt;     complex_long_double;&lt;br /&gt;&lt;br /&gt;    #else&lt;br /&gt;&lt;br /&gt;     #include &lt;complex.h&gt;&lt;br /&gt;&lt;br /&gt;     typedef complex float            complex_float;&lt;br /&gt;     typedef complex double           complex_double;&lt;br /&gt;     typedef complex long double      complex_long_double;&lt;br /&gt;&lt;br /&gt;     typedef imaginary float          imaginary_float;&lt;br /&gt;     typedef imaginary double         imaginary_double;&lt;br /&gt;     typedef imaginary long double    imaginary_long_double;&lt;br /&gt;&lt;br /&gt;    #endif &lt;br /&gt;Including these definitions allows for portable code that will compile as both C and C++ code, such as:&lt;br /&gt;&lt;br /&gt;    complex_double square_cd(complex_double a)&lt;br /&gt;    {&lt;br /&gt;        return (a * a);&lt;br /&gt;    } &lt;br /&gt;[C99: §6.2.5, 6.3.1.6, 6.3.1.7, 6.3.1.8] &lt;br /&gt;[C++98: §26.2]&lt;br /&gt;&lt;br /&gt;Compound literals&lt;br /&gt;C99 allows literals having types other than primitive types (e.g., user-defined structure or array types) to be specified in constant expressions; these are called compound literals. For example:&lt;br /&gt;&lt;br /&gt;    struct info&lt;br /&gt;    {&lt;br /&gt;        char    name[8+1];&lt;br /&gt;        int     type;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    extern void  add(struct info s);&lt;br /&gt;    extern void  move(float coord[2]);&lt;br /&gt;&lt;br /&gt;    void predef(void)&lt;br /&gt;    {&lt;br /&gt;        add((struct info){ "e", 0 });      // A struct literal&lt;br /&gt;        move((float[2]){ +0.5, -2.7 });    // An array literal&lt;br /&gt;    } &lt;br /&gt;C++ does not support this feature.&lt;br /&gt;&lt;br /&gt;C++ does provides a similar capability through the use of non-default class constructors, but which is not quite as flexible as the C feature:&lt;br /&gt;&lt;br /&gt;    void predef2()&lt;br /&gt;    {&lt;br /&gt;        add(info("e", 0));      // Call constructor info::info()&lt;br /&gt;    } &lt;br /&gt;(This C feature might be provided as an extension by some C++ compilers, but would probably be valid only for POD structure types and arrays of POD types.)&lt;br /&gt;&lt;br /&gt;[C99: §6.5.2, 6.5.2.5] &lt;br /&gt;[C++98: §5.2.3, 8.5, 12.1, 12.2]&lt;br /&gt;&lt;br /&gt;const linkage&lt;br /&gt;C specifies that a variable declared with a const qualifier is not a modifiable object. In all other regards, though, it is treated the same as any other variable. Specifically, if a const object with file scope is not explicitly declared static, its name has external linkage and is visible to other source modules.&lt;br /&gt;&lt;br /&gt;    const int           i = 1;  // External linkage&lt;br /&gt;&lt;br /&gt;    extern const int    j = 2;  // 'extern' optional&lt;br /&gt;    static const int    k = 3;  // 'static' required &lt;br /&gt;C++ specifies that a const object with file scope has internal linkage by default, meaning that the object's name is not visible outside the source file in which it is declared. A const object must be declared with an explicit extern specifier in order to be visible to other source modules.&lt;br /&gt;&lt;br /&gt;    const int           i = 1;  // Internal linkage&lt;br /&gt;&lt;br /&gt;    extern const int    j = 2;  // 'extern' required&lt;br /&gt;    static const int    k = 3;  // 'static' optional &lt;br /&gt;The recommended practice is therefore to define constants with an explicit static or extern specifier.&lt;br /&gt;&lt;br /&gt;[C99: §6.2.2, 6.7.3] &lt;br /&gt;[C++98: §7.1.5.1]&lt;br /&gt;&lt;br /&gt;Designated initializers&lt;br /&gt;C99 introduces the feature of designated initializers, which allows specific members of structures, unions, or arrays to be initialized explicitly by name or subscript. For example:&lt;br /&gt;&lt;br /&gt;    struct info&lt;br /&gt;    {&lt;br /&gt;        char    name[8+1];&lt;br /&gt;        int     sz;&lt;br /&gt;        int     typ;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    struct info  arr[] =&lt;br /&gt;    {&lt;br /&gt;        [0] = { .sz = 20, .name = "abc" },&lt;br /&gt;        [9] = { .sz = -1, .name = "" }&lt;br /&gt;    }; &lt;br /&gt;Unspecified members are default-initialized.&lt;br /&gt;C++ does not support this feature.&lt;br /&gt;&lt;br /&gt;(This feature might be provided as an extension by some C++ compilers, but would probably be valid only for POD structure types and arrays of POD types. However, C++ already provides a similar capability through the use of non-default class constructors.)&lt;br /&gt;&lt;br /&gt;[C99: §6.7.8] &lt;br /&gt;[C++98: §8.5.1, 12.1]&lt;br /&gt;&lt;br /&gt;Duplicate typedefs&lt;br /&gt;C does not allow a given typedef to appear more than once in the same scope.&lt;br /&gt;&lt;br /&gt;C++ handles typedefs and type names differently than C, and allows redundant occurrences of a given typedef within the same scope.&lt;br /&gt;&lt;br /&gt;Thus the following code is valid in C++ but invalid in C:&lt;br /&gt;&lt;br /&gt;    typedef int  MyInt;&lt;br /&gt;    typedef int  MyInt;     // Valid C++, invalid C &lt;br /&gt;This means that typedefs that might be included more than once in a program (e.g., common typedefs that occur in multiple header files) should be guarded by preprocessing directives if such source code is meant to be compiled as both C and C++. For example:&lt;br /&gt;&lt;br /&gt;    //========================================&lt;br /&gt;    // one.h&lt;br /&gt;&lt;br /&gt;    #ifndef MYINT_T&lt;br /&gt;     #define MYINT_T&lt;br /&gt;     typedef int  MyInt;&lt;br /&gt;    #endif&lt;br /&gt;    ...&lt;br /&gt;&lt;br /&gt;    //========================================&lt;br /&gt;    // two.h&lt;br /&gt;&lt;br /&gt;    #ifndef MYINT_T&lt;br /&gt;     #define MYINT_T&lt;br /&gt;     typedef int  MyInt;&lt;br /&gt;    #endif&lt;br /&gt;    ... &lt;br /&gt;Thus code can include multiple header files without causing an error in C:&lt;br /&gt;&lt;br /&gt;    // Include multiple headers that define typedef MyInt&lt;br /&gt;    #include "one.h"&lt;br /&gt;    #include "two.h"&lt;br /&gt;&lt;br /&gt;    MyInt   my_counter = 0; &lt;br /&gt;[C99: §6.7, 6.7.7] &lt;br /&gt;[C++98: §7.1.3]&lt;br /&gt;&lt;br /&gt;Dynamic sizeof evaluation&lt;br /&gt;Because C99 supports variable-length arrays (VLAs), the sizeof operator does not necessarily evaluate to a constant (compile-time) value. Any expression that involves applying the sizeof operator to a VLA operand must be evaluated at runtime (any other use of sizeof can be evaluated at compile time). For example:&lt;br /&gt;&lt;br /&gt;    size_t dsize(int sz)&lt;br /&gt;    {&lt;br /&gt;        float   arr[sz];          // VLA, dynamically allocated&lt;br /&gt;&lt;br /&gt;        if (sz &lt;= 0)&lt;br /&gt;            return sizeof(sz);    // Evaluated at compile time&lt;br /&gt;        else&lt;br /&gt;            return sizeof(arr);   // Evaluated at runtime&lt;br /&gt;    } &lt;br /&gt;C++ does not support VLAs, so C code that applies the sizeof operator to VLA operands will cause problems when compiled as C++.&lt;br /&gt;&lt;br /&gt;[C99: §6.5.3.4, 6.7.5, 6.7.5.2] &lt;br /&gt;[C++98: §5.3, 5.3.3]&lt;br /&gt;&lt;br /&gt;Empty parameter lists&lt;br /&gt;C distinguishes between a function declared with an empty parameter list and a function declared with a parameter list consisting of only void. The former is an unprototyped function taking an unspecified number of arguments, while the latter is a prototyped function taking no arguments.&lt;br /&gt;&lt;br /&gt;    // C code&lt;br /&gt;&lt;br /&gt;    extern int  foo();          // Unspecified parameters&lt;br /&gt;    extern int  bar(void);      // No parameters&lt;br /&gt;&lt;br /&gt;    void baz()&lt;br /&gt;    {&lt;br /&gt;        foo(0);         // Valid C, invalid C++&lt;br /&gt;        foo(1, 2);      // Valid C, invalid C++&lt;br /&gt;&lt;br /&gt;        bar();          // Okay in both C and C++&lt;br /&gt;        bar(1);         // Error in both C and C++&lt;br /&gt;    } &lt;br /&gt;C++, on the other hand, makes no distinction between the two declarations and considers them both to mean a function taking no arguments.&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;&lt;br /&gt;    extern int  xyz();&lt;br /&gt;&lt;br /&gt;    extern int  xyz(void);  // Same as 'xyz()' in C++,&lt;br /&gt;                            // Different and invalid in C &lt;br /&gt;For code that is intended to be compiled as either C or C++, the best solution to this problem is to always declare functions taking no parameters with an explicit void prototype. For example:&lt;br /&gt;&lt;br /&gt;    // Compiles as both C and C++&lt;br /&gt;    int bosho(void)&lt;br /&gt;    {&lt;br /&gt;        ...&lt;br /&gt;    } &lt;br /&gt;Empty function prototypes are a deprecated feature in C99 (as they were in C89).&lt;br /&gt;&lt;br /&gt;[C99: §6.7.5.3] &lt;br /&gt;[C++98: §8.3.5, C.1.6.8.3.5]&lt;br /&gt;&lt;br /&gt;Empty preprocessor function macro arguments&lt;br /&gt;C99 allows preprocessor function macros to be specified with empty (missing) arguments.&lt;br /&gt;&lt;br /&gt;    #define ADD3(a,b,c)  (+ a + b + c + 0)&lt;br /&gt;&lt;br /&gt;    ADD3(1, 2, 3)   =&gt; (+ 1 + 2 + 3 + 0)&lt;br /&gt;    ADD3(1, 2, )    =&gt; (+ 1 + 2 + + 0)&lt;br /&gt;    ADD3(1, , 3)    =&gt; (+ 1 + + 3 + 0)&lt;br /&gt;    ADD3(1,,)       =&gt; (+ 1 + + + 0)&lt;br /&gt;    ADD3(,,)        =&gt; (+ + + + 0) &lt;br /&gt;C++ does not support empty preprocessor function macros arguments.&lt;br /&gt;&lt;br /&gt;(This feature is likely to be provided as an extension by many C++ compilers.)&lt;br /&gt;&lt;br /&gt;[C99: §6.10.3, 6.10.3.1] &lt;br /&gt;[C++98: §16.3., 16.3.1]&lt;br /&gt;&lt;br /&gt;Enumeration constants&lt;br /&gt;Enumeration constants in C are essentially just named constants of type signed int. As such, they are constrained to having an initialization value that falls within the range [INT_MIN,INT_MAX]. This also means that for any given enumeration constant RED, the values of sizeof(RED) and sizeof(int) are always the same.&lt;br /&gt;&lt;br /&gt;C++ enumeration constants have the same type as their enumeration type, which means that they have the same size and alignment as their underlying integer type. This means that the values of sizeof(RED) and sizeof(int) are not necessarily the same for any given enumeration constant RED. Enumeration constants also have a wider range of possible underlying types in C++ than in C: signed int, unsigned int, signed long, and unsigned long. As such, they also have a wider range of valid initialization values.&lt;br /&gt;&lt;br /&gt;This may cause incompatibilities for C code compiled as C++, if the C++ compiler chooses to implement an enumeration type as a different size than it would be in C, or if the program relies on the results of expressions such as sizeof(RED).&lt;br /&gt;&lt;br /&gt;    enum ControlBits&lt;br /&gt;    {&lt;br /&gt;        CB_LOAD =   0x0001,&lt;br /&gt;        CB_STORE =  0x0002,&lt;br /&gt;        ...&lt;br /&gt;        CB_TRACE =  LONG_MAX+1,       // (Undefined behavior)&lt;br /&gt;        CB_ALL =    ULONG_MAX&lt;br /&gt;    }; &lt;br /&gt;[C99: §6.4.4.3, 6.7.2.2] &lt;br /&gt;[C++98: §4.5, 7.2]&lt;br /&gt;&lt;br /&gt;Enumeration declarations with trailing comma&lt;br /&gt;C99 allows a trailing comma to follow the last enumeration constant initializer within an enumeration type declaration, similar to structure member initialization lists. For example:&lt;br /&gt;&lt;br /&gt;    enum Color { RED = 0, GREEN, BLUE, }; &lt;br /&gt;C++ does not allow this.&lt;br /&gt;&lt;br /&gt;(This feature is likely to be provided as an extension by many C++ compilers.)&lt;br /&gt;&lt;br /&gt;[C99: §6.7.2.2] &lt;br /&gt;[C++98: §7.2]&lt;br /&gt;&lt;br /&gt;Enumeration types&lt;br /&gt;C specifies that each enumerated type is a unique type, distinct from all other enumerated types within the same program. The implementation is free to use a different underlying primitive integer type for each enumerated type. This means that sizeof(enum A) and sizeof(enum B) are not necessarily the same. This also means, given that RED is an enumeration constant of type enum Color, that sizeof(RED) and sizeof(enum Color) are not necessarily the same (since all enumeration constants are of type signed int).&lt;br /&gt;&lt;br /&gt;All enumeration constants, though, convert to values of type signed int when they appear in expressions. Since enumeration constants cannot portably be wider than int, it might appear that int is the widest enumeration type; however, implementations are free to support wider enumeration integer types. Such extended types may be different than the types used by a C++ compiler, however.&lt;br /&gt;&lt;br /&gt;In C, objects of enumeration types may be assigned integer values without the need for a explicit cast. For example:&lt;br /&gt;&lt;br /&gt;    // C code&lt;br /&gt;&lt;br /&gt;    enum Color { RED, BLUE, GREEN };&lt;br /&gt;&lt;br /&gt;    int         c = RED;    // Cast not needed&lt;br /&gt;    enum Color  col = 1;    // Cast not needed &lt;br /&gt;C++ also specifies that all enumerated types are unique and distinct types, but it goes further than C to enforce this. In particular, a function name can be overloaded to take an argument of different enumerated types. While objects of enumerated types implicitly convert to integer values, integer values require an explicit cast to be converted into enumerated types. Implicitly converted enumeration values are converted to their underlying integer type, which is not necessarily signed int. For example:&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;&lt;br /&gt;    enum Color { ... };&lt;br /&gt;&lt;br /&gt;    enum Color setColor(int h)&lt;br /&gt;    {&lt;br /&gt;        enum Color  c;&lt;br /&gt;&lt;br /&gt;        c = h;             // Error, no implicit conversion&lt;br /&gt;        return c;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    int hue(enum Color c)&lt;br /&gt;    {&lt;br /&gt;        return (c + 128);  // Implicit conversion,&lt;br /&gt;                           // but might not be signed int&lt;br /&gt;    } &lt;br /&gt;Since a C++ enumeration constant has the same type and size as its enumeration type, this means, given that RED is an enumeration constant of type enum Color, that the values of sizeof(RED) and sizeof(enum Color) are exactly the same, which differs from the rules in C.&lt;br /&gt;&lt;br /&gt;There is no guarantee that a given enumeration type is implemented as the same underlying type in both C and C++, or even in different C implementations. This affects the calling interface between C and C++ functions. This may also cause incompatibilities for C code compiled as C++, if the C++ compiler chooses to implement an enumeration type as a different size that it would be in C, or if the program relies on the results of expressions such as sizeof(RED).&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;&lt;br /&gt;    enum Color { ... };&lt;br /&gt;&lt;br /&gt;    extern "C" void  foo(Color c);&lt;br /&gt;                        // Parameter types might not match&lt;br /&gt;&lt;br /&gt;    void bar(Color c)&lt;br /&gt;    {&lt;br /&gt;        foo(c);         // Enum types might be different sizes&lt;br /&gt;    } &lt;br /&gt;[C99: §6.4.4.3, 6.7.2.2] &lt;br /&gt;[C++98: §4.5, 7.2]&lt;br /&gt;&lt;br /&gt;Flexible array members (FAMs)&lt;br /&gt;This is also known as the struct hack. This specifies a conforming way to declare a structure containing a set of fixed-sized members followed by a flexible array member that can hold an unspecified number of elements. Such a structure is typically allocated by calling malloc(), passing it the number of bytes beyond the fixed portion of the structure to add to the allocation size. For example:&lt;br /&gt;&lt;br /&gt;    struct Hack&lt;br /&gt;    {&lt;br /&gt;        int     count;    // Fixed member(s)&lt;br /&gt;        int     fam[];    // Flexible array member&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    struct Hack * vmake(int sz)&lt;br /&gt;    {&lt;br /&gt;        struct Hack *  p;&lt;br /&gt;&lt;br /&gt;        p = malloc(sizeof(struct Hack) + sz*sizeof(int));&lt;br /&gt;                            // Allocate a variable-sized structure&lt;br /&gt;&lt;br /&gt;        p-&gt;count = sz;&lt;br /&gt;        for (int i = 0; i &lt; sz; i++)&lt;br /&gt;            p-&gt;fam[i] = i;&lt;br /&gt;&lt;br /&gt;        return p;&lt;br /&gt;    } &lt;br /&gt;C++ does not support flexible array members.&lt;br /&gt;&lt;br /&gt;(This feature might be provided as an extension by some C++ compilers, but would probably be valid only for POD structure types.)&lt;br /&gt;&lt;br /&gt;[C99: §6.7.2.1] &lt;br /&gt;[C++98: §8.3.4]&lt;br /&gt;&lt;br /&gt;Function name mangling&lt;br /&gt;In order to implement overloaded functions and member functions, C++ compilers must have a means of mapping the source names of functions into unique symbols in the object code resulting from the compile. For example, the functions ::foo(int), ::foo(float), and Mine::foo() all have identical names (foo) but different calling signatures. In order for the linker to distinguish between the functions during program link time, they must be mangled into different symbolic names.&lt;br /&gt;&lt;br /&gt;This differs from the way functions names are mapped into symbolic object names in C, which allows for certain cases of type punning (between signed and unsigned integer types) and non-prototyped extern functions. Therefore C programs compiled as C++ will produce different symbolic names, unless the functions are explicitly declared as having extern "C" linkage. For example:&lt;br /&gt;&lt;br /&gt;    int  foo(int i);   // Different symbolic names in C and C++&lt;br /&gt;&lt;br /&gt;    #ifdef __cplusplus&lt;br /&gt;    extern "C"&lt;br /&gt;    #endif&lt;br /&gt;    int  bar(int i);   // Same symbolic name in both C and C++ &lt;br /&gt;C++ functions are implicitly declared with extern "C++" linkage.&lt;br /&gt;&lt;br /&gt;Another consequence of C++ function name mangling is that identifiers in C++ are not allowed to contain two or more consecutive underscores (e.g., the name foo__bar is invalid). Such names are reserved for the implementation, ostensibly so that it may have a guaranteed means of mangling source function names into unique object symbolic names. (For example, an implementation might choose to mangle the member function Mine::foo(int) into something like foo__4Mine_Fi, which is a symbolic name containing consecutive underscores.)&lt;br /&gt;&lt;br /&gt;C does not reserve such names, so a C program is free to use such names in any manner. For example:&lt;br /&gt;&lt;br /&gt;    void foo__bar(int i)  // Improper C++ name&lt;br /&gt;    { ... } &lt;br /&gt;[C99: §5.2.4.1, 6.2.2, 6.4.2.1] &lt;br /&gt;[C++98: §2.10, 3.5, 17.4.2.2, 17.4.3.1.2, 17.4.3.1.3]&lt;br /&gt;&lt;br /&gt;Function pointers&lt;br /&gt;C++ functions have extern "C++" linkage by default. In order to call C functions from C++, the functions must be declared with extern "C" linkage. This is typically accomplished by placing C function declarations within an extern "C" block:&lt;br /&gt;&lt;br /&gt;    extern "C"&lt;br /&gt;    {&lt;br /&gt;        extern int  api_read(int f, char *b);&lt;br /&gt;        extern int  api_write(int f, const char *b);&lt;br /&gt;    } &lt;br /&gt;    extern "C"&lt;br /&gt;    {&lt;br /&gt;        #include "api.h"&lt;br /&gt;    } &lt;br /&gt;But simply declaring functions with extern "C" linkage is not enough to ensure that C++ functions can call C functions properly. Specifically, pointers to extern "C" functions and pointers to extern "C++" functions are not compatible. When compiled as C++ code, function pointer declarations are implicitly defined as having extern "C++" linkage, so they cannot be assigned addresses of extern "C" functions. (Function pointers can thus be a source of problems when dealing with C API libraries and C callback functions.)&lt;br /&gt;&lt;br /&gt;    extern int      mish(int i);    // extern "C++" function&lt;br /&gt;&lt;br /&gt;    extern "C" int  mash(int i);&lt;br /&gt;&lt;br /&gt;    void foo(int a)&lt;br /&gt;    {&lt;br /&gt;        int  (*pf)(int i);          // C++ function pointer&lt;br /&gt;&lt;br /&gt;        pf = &amp;mish;                 // Okay, C++ function address&lt;br /&gt;        (*pf)(a);&lt;br /&gt;&lt;br /&gt;        pf = &amp;mash;                 // Error, C function address&lt;br /&gt;        (*pf)(a);&lt;br /&gt;    } &lt;br /&gt;To make the combination of function pointers and extern "C" functions work correctly in C++, function pointers that are assigned addresses of C functions must be changed to have extern "C" linkage.&lt;br /&gt;&lt;br /&gt;One solution is to use a typedef with the proper linkage:&lt;br /&gt;&lt;br /&gt;    extern "C"&lt;br /&gt;    {&lt;br /&gt;        typedef int  (*Pcf)(int);   // C function pointer&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void bar(int a)&lt;br /&gt;    {&lt;br /&gt;        int  (*pf)(int i);          // C++ function pointer&lt;br /&gt;&lt;br /&gt;        pf = &amp;mish;                 // Okay, C++ function address&lt;br /&gt;        (*pf)(a);&lt;br /&gt;&lt;br /&gt;        Pcf  pc;                    // C function pointer&lt;br /&gt;&lt;br /&gt;        pc = &amp;mash;                 // Okay, C function address&lt;br /&gt;        (*pc)(a);&lt;br /&gt;    } &lt;br /&gt;[C99: §6.2.5, 6.3.2.3, 6.5.2.2] &lt;br /&gt;[C++98: §5.2.2, 17.4.2.2, 17.4.3.1.3]&lt;br /&gt;&lt;br /&gt;Hexadecimal floating-point literals&lt;br /&gt;C99 recognizes hexadecimal floating-point literals, having a "0x" prefix and a "p" exponent specifier. For example:&lt;br /&gt;&lt;br /&gt;    float  pi = 0x3.243F6A88p+03; &lt;br /&gt;C99 also provides additional format specifiers for the printf() and scanf() family of standard library functions:&lt;br /&gt;&lt;br /&gt;    printf("%9.3a", f);&lt;br /&gt;    printf("%12.6lA", d); &lt;br /&gt;(These features are likely to be provided as extensions by many C++ compilers.)&lt;br /&gt;&lt;br /&gt;[C99: §6.4.4.2, 6.4.8] &lt;br /&gt;[C++98: §2.9, 2.13.3]&lt;br /&gt;&lt;br /&gt;IEC 60559 arithmetic support&lt;br /&gt;C99 allows an implementation to pre-define the __STD_IEC_559 preprocessor macro, indicating that it conforms to certain required behavior of the IEC 60559 (a.k.a. IEEE 599) specification regarding floating-point arithmetic and library functions. Implementations that do not pre-define this macro are not require to provide conforming floating-point behavior.&lt;br /&gt;&lt;br /&gt;C++ does not make any special provisions for implementations that explicitly support the IEC 60559 floating-point specification.&lt;br /&gt;&lt;br /&gt;Conformance to IEC 60559 floating-point arithmetic, and the pre-definition of the __STD_IEC_559 macro, is likely to be provided as an extension by many C++ compilers.&lt;br /&gt;&lt;br /&gt;C99 also allows an implementation to pre-define the __STD_IEC_559_COMPLEX preprocessor macro to indicate that it conforms to the behavior specified by IEC 60559 for complex floating-point arithmetic and library functions. This affects the way the _Complex and _Imaginary types are implemented.&lt;br /&gt;&lt;br /&gt;C++ provides library functions for complex floating-point arithmetic by providing the complex&lt;&gt; template class, declared in the standard &lt;complex&gt; header file. This type is incompatible with the C99 complex types.&lt;br /&gt;&lt;br /&gt;Conformance to the complex arithmetic specification, and the pre-definition of the __STD_IEC_559 macro, might also be provided by many C++ compilers, and this would indicate how the complex&lt;&gt; template class is implemented.&lt;br /&gt;&lt;br /&gt;[C99: §6.10.8, F, G] &lt;br /&gt;[C++98: §16.8]&lt;br /&gt;&lt;br /&gt;Inline functions&lt;br /&gt;Both C99 and C++ allow functions to be defined as inline, which is a hint to the compiler that invocations of such functions can be replaced with inline code expansions rather than actual function calls. Inline functions are not supposed to be a source of incompatibilities between C99 and C++ in practice, but there is a small difference in the semantics of the two languages.&lt;br /&gt;&lt;br /&gt;C++ requires all of the definitions for a given inline function to be composed of exactly the same token sequence.&lt;br /&gt;&lt;br /&gt;C99, however, allows multiple definitions of a given inline function to be different, and does not require the compiler to detect such differences or issue a diagnostic.&lt;br /&gt;&lt;br /&gt;Thus the following two example source files, which define two slightly different versions of the same inline function, constitute acceptable C99 code but invalid C++ code:&lt;br /&gt;&lt;br /&gt;    //========================================&lt;br /&gt;    // one.c&lt;br /&gt;&lt;br /&gt;    inline int twice(int i)         // One definition&lt;br /&gt;    {&lt;br /&gt;        return i * i;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    int foo(int j)&lt;br /&gt;    {&lt;br /&gt;        return twice(j);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //========================================&lt;br /&gt;    // two.c&lt;br /&gt;&lt;br /&gt;    typedef int  integer;&lt;br /&gt;&lt;br /&gt;    inline integer twice(integer a) // Another definition&lt;br /&gt;    {&lt;br /&gt;        return (a * a);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    int bar(int b)&lt;br /&gt;    {&lt;br /&gt;        return twice(b);&lt;br /&gt;    } &lt;br /&gt;This should not be a problem in practice, provided that multiple inline function definitions occur only in shared header files (which ensures that the multiple function definitions are composed of the same token sequences).&lt;br /&gt;&lt;br /&gt;[C99: §6.7.4] &lt;br /&gt;[C++98: §7.1.2]&lt;br /&gt;&lt;br /&gt;Integer types headers&lt;br /&gt;C99 provides the header file &lt;stdint.h&gt;, which contains declarations and macro definitions for standard integer types. For example:&lt;br /&gt;&lt;br /&gt;    int  height(int_least32_t x);&lt;br /&gt;    int  width(uint16_t x); &lt;br /&gt;C++ does not provide these types or header files.&lt;br /&gt;&lt;br /&gt;(This feature is likely to be provided as an extension by many C++ compilers. Some C++ compilers might also provide a &lt;cstdint&gt; header file as an extension.)&lt;br /&gt;&lt;br /&gt;[C99: §7.1.2, 7.18] &lt;br /&gt;[C++98: §17.4.1.2, D.5]&lt;br /&gt;&lt;br /&gt;Library function prototypes&lt;br /&gt;The C++ standard library header files amend some of the standard C library function declarations so as to be more type-safe when used in C++. For example, the standard C library function declaration:&lt;br /&gt;&lt;br /&gt;    // &lt;string.h&gt;&lt;br /&gt;    extern char *   strchr(const char *s, int c); &lt;br /&gt;is replaced with these near-equivalent declarations in the C++ library:&lt;br /&gt;    // &lt;cstring&gt;&lt;br /&gt;    extern const char * strchr(const char *s, int c);&lt;br /&gt;    extern char *       strchr(char *s, int c); &lt;br /&gt;These slightly different declarations can cause problems when C code is compiled as C++ code, such as:&lt;br /&gt;    // C code&lt;br /&gt;    const char * s = ...;&lt;br /&gt;    char *       p;&lt;br /&gt;&lt;br /&gt;    p = strchr(s, 'a');             // Valid C, invalid C++ &lt;br /&gt;This kind of code results in an attempt to assign a const pointer returned from a function to a non-const variable. A simple cast corrects the code, making it valid as both C++ and C code, as in:&lt;br /&gt;    // Corrected for C++&lt;br /&gt;    p = (char *) strchr(s, 'a');    // Valid C and C++ &lt;br /&gt;[C99: §7.21.5, 7.24.4.5] &lt;br /&gt;[C++98: §17.4.1.2, 21.4]&lt;br /&gt;&lt;br /&gt;Library header files&lt;br /&gt;C++ provides the standard C89 library as part of its library.&lt;br /&gt;&lt;br /&gt;C99 adds a few header files that are not included as part of the standard C++ library, though:&lt;br /&gt;&lt;br /&gt;&lt;complex.h&gt;&lt;br /&gt;&lt;fenv.h&gt;&lt;br /&gt;&lt;inttypes.h&gt;&lt;br /&gt;&lt;stdbool.h&gt;&lt;br /&gt;&lt;stdint.h&gt;&lt;br /&gt;&lt;tgmath.h&gt;&lt;br /&gt;Even though C++ provides the C89 standard C library headers as part of its library, it deems their use as deprecated. Instead, it encourages programmers to prefer the equivalent set of C++ header files which provide the same functionality as the C header files:&lt;br /&gt;&lt;br /&gt;&lt;math.h&gt; replaced by &lt;cmath&gt;&lt;br /&gt;&lt;stddef.h&gt; replaced by &lt;cstddef&gt;&lt;br /&gt;&lt;stdio.h&gt; replaced by &lt;cstdio&gt;&lt;br /&gt;&lt;stdlib.h&gt; replaced by &lt;cstdlib&gt;&lt;br /&gt;etc.  etc.&lt;br /&gt;Deprecating the use of the C header files thus makes the following valid C++98 program possibly invalid under a future revision of standard C++:&lt;br /&gt;&lt;br /&gt;    #include &lt;stdio.h&gt;     // Deprecated in C++&lt;br /&gt;&lt;br /&gt;    int main(void)&lt;br /&gt;    {&lt;br /&gt;        printf("Hello, world\n");&lt;br /&gt;        return 0;&lt;br /&gt;    } &lt;br /&gt;The program can be modified by removing the use of deprecated features in order to make it portable to future implementations of standard C++:&lt;br /&gt;&lt;br /&gt;    #ifdef __cplusplus&lt;br /&gt;     #include &lt;cstdio&gt;     // C++ only&lt;br /&gt;     using std::printf;&lt;br /&gt;    #else&lt;br /&gt;     #include &lt;stdio.h&gt;    // C only&lt;br /&gt;    #endif&lt;br /&gt;&lt;br /&gt;    int main(void)&lt;br /&gt;    {&lt;br /&gt;        printf("Hello, world\n");&lt;br /&gt;        return 0;&lt;br /&gt;    } &lt;br /&gt;[C99: §7.1.2] &lt;br /&gt;[C++98: §17.4.1.2, D.5]&lt;br /&gt;&lt;br /&gt;long long integer type&lt;br /&gt;C99 provides signed long long and unsigned long long integer types to its repertoire of primitive types, which are binary integer types at least 64 bits wide.&lt;br /&gt;&lt;br /&gt;C99 also has enhanced lexical rules to allow for integer constants of these types. For example:&lt;br /&gt;&lt;br /&gt;    long long int           i = -9000000000000000000LL;&lt;br /&gt;    unsigned long long int  u = 18000000000000000000LLU; &lt;br /&gt;C99 also provides several new macros in &lt;limits.h&gt;, new format specifiers for the printf() and scanf() family of standard library functions, and additional standard library functions that support these types. For example:&lt;br /&gt;&lt;br /&gt;    void pr(long long i)&lt;br /&gt;    {&lt;br /&gt;        printf("%lld", i);&lt;br /&gt;    } &lt;br /&gt;C++ does not recognize these integer types.&lt;br /&gt;&lt;br /&gt;(These features are likely to be provided as extensions by many C++ compilers, especially those that provide the same runtime library for both C and C++ environments.)&lt;br /&gt;&lt;br /&gt;[C99: §5.2.4.2.1, 6.2.5, 6.3.1.1, 6.4.4.1, 6.7.2, 7.12.9, 7.18.4, 7.19.6.1, 7.19.6.2, 7.20.1, 7.20.6, 7.24.2.1, 7.24.2.2, 7.24.4, A.1.5, B.11, B.19, B.23, F.3, H.2] &lt;br /&gt;[C++98: §2.13.1, 3.9.1, 21.4, 22.2.2.2.2, 27.8.2, C.2]&lt;br /&gt;&lt;br /&gt;Nested structure tags&lt;br /&gt;Nested structure types may be declared within other structures. The scope of the inner structure tag extends outside the scope of the outer structure in C, but does not do so in C++. Structure declarations possess their own scope in C++, but do not in C. This applies to any struct, union, and enumerated types declared within a structure declaration. For example:&lt;br /&gt;&lt;br /&gt;    struct Outer&lt;br /&gt;    {&lt;br /&gt;        struct Inner        // Nested structure declaration&lt;br /&gt;        {&lt;br /&gt;            int         a;&lt;br /&gt;            float       f;&lt;br /&gt;        }           in;&lt;br /&gt;&lt;br /&gt;        enum E              // Nested enum type declaration&lt;br /&gt;        {&lt;br /&gt;            UKNOWN, OFF, ON&lt;br /&gt;        }           state;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    struct Inner    si;     // Nested type is visible in C,&lt;br /&gt;                            // Not visible in C++&lt;br /&gt;&lt;br /&gt;    enum E          et;     // Nested type is visible in C,&lt;br /&gt;                            // Not visible in C++ &lt;br /&gt;In order to be visible in C++, the inner declarations must be explicitly named using its outer class prefix, or they must be declared outside the outer structure so that they have file scope. The former case, for example:&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;&lt;br /&gt;    Outer::Inner     si;    // Explicit type name&lt;br /&gt;    Outer::E         et;    // Explicit type name &lt;br /&gt;And the latter case:&lt;br /&gt;&lt;br /&gt;    // C and C++ code&lt;br /&gt;&lt;br /&gt;    struct Inner            // Declaration is no longer nested&lt;br /&gt;    {&lt;br /&gt;        int         a;&lt;br /&gt;        float       f;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    enum E                  // Declaration is no longer nested&lt;br /&gt;    {&lt;br /&gt;        UKNOWN, OFF, ON&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    struct Outer&lt;br /&gt;    {&lt;br /&gt;        struct Inner    in;&lt;br /&gt;        enum E          state;&lt;br /&gt;    }; &lt;br /&gt;[C99: §6.2.1, 6.2.3, 6.7.2.1, 6.7.2.3] &lt;br /&gt;[C++98: §9.9, C.1.2.3.3]&lt;br /&gt;&lt;br /&gt;Non-prototype function declarations&lt;br /&gt;C supports non-prototype (a.k.a. K&amp;R-style) function definitions. (Like C90, C99 deems this as deprecated practice.) For example:&lt;br /&gt;&lt;br /&gt;    int foo(a, b)     // Deprecated syntax&lt;br /&gt;        int  a;&lt;br /&gt;        int  b;&lt;br /&gt;    {&lt;br /&gt;        return (a + b);&lt;br /&gt;    } &lt;br /&gt;C++ allows only prototyped function definitions. So in order to compile the example above as C++ code, it must be rewritten in function prototype form:&lt;br /&gt;&lt;br /&gt;    int foo(int a, int b)&lt;br /&gt;    {&lt;br /&gt;        return (a + b);&lt;br /&gt;    } &lt;br /&gt;[C99: §6.2.7, 6.5.2.2, 6.7.5.3, 6.9.1, 6.11.6, 6.11.7] &lt;br /&gt;[C++98: §5.2.2, 8.3.5, 8.4, C.1.6]&lt;br /&gt;&lt;br /&gt;Old-style casts&lt;br /&gt;C++ provides four typecast operators:&lt;br /&gt;&lt;br /&gt;const_cast&lt;br /&gt;dynamic_cast&lt;br /&gt;reinterpret_cast&lt;br /&gt;static_cast&lt;br /&gt;While the following C code is also valid C++98 code, it may not be considered valid code in a future revision of the C++ standard:&lt;br /&gt;&lt;br /&gt;    char *        p;&lt;br /&gt;    const char *  s = (const char *) p; &lt;br /&gt;One possible work-around is to use macros in C that simulate the C++ typecast operators:&lt;br /&gt;&lt;br /&gt;    #ifdef __cplusplus&lt;br /&gt;     #define const_cast(t,e)        const_cast&lt;t&gt;(e)&lt;br /&gt;     #define dynamic_cast(t,e)      dynamic_cast&lt;t&gt;(e)&lt;br /&gt;     #define reinterpret_cast(t,e)  reinterpret_cast&lt;t&gt;(e)&lt;br /&gt;     #define static_cast(t,e)       static_cast&lt;t&gt;(e)&lt;br /&gt;    #else&lt;br /&gt;     #define const_cast(t,e)        ((t)(e))&lt;br /&gt;     #define dynamic_cast(t,e)      ((t)(e))&lt;br /&gt;     #define reinterpret_cast(t,e)  ((t)(e))&lt;br /&gt;     #define static_cast(t,e)       ((t)(e))&lt;br /&gt;    #endif&lt;br /&gt;&lt;br /&gt;    const char *  s = const_cast(const char *, p); &lt;br /&gt;All four casts are included above even though dynamic_cast is not really useful in C code. Perhaps a better definition for dynamic_cast in C would be:&lt;br /&gt;&lt;br /&gt;     #define dynamic_cast(t,e)      _Do_not_use_dynamic_cast&lt;br /&gt;                                        // Produces a compile-time error &lt;br /&gt;C++ also provides functional typecasts, which are not recognized in C:&lt;br /&gt;&lt;br /&gt;    f = float(i);   // C++ cast to float; invalid C &lt;br /&gt;These kinds of typecasts cannot be used in code that is compiled as both C and C++.&lt;br /&gt;&lt;br /&gt;[C99: §6.3, 6.54] &lt;br /&gt;[C++98: §5.2, 5.2.3, 5.2.7, 5.2.9, 5.2.10, 5.2.11, 5.4, 14.6.2.2, 14.6.2.3]&lt;br /&gt;&lt;br /&gt;One definition rule&lt;br /&gt;C allows tentative definitions for variables, e.g.:&lt;br /&gt;&lt;br /&gt;    int  i;        // Tentative definition&lt;br /&gt;    int  i = 1;    // Explicit definition &lt;br /&gt;C++ does not allow this. Only one definition of any given variable is allowed within a program.&lt;br /&gt;&lt;br /&gt;C also allows, or at least does not require a diagnostic for, different source files containing conflicting definitions. For example:&lt;br /&gt;&lt;br /&gt;    //========================================&lt;br /&gt;    // one.c&lt;br /&gt;&lt;br /&gt;    struct Capri                // A declaration&lt;br /&gt;    {&lt;br /&gt;        int     a;&lt;br /&gt;        int     b;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    //========================================&lt;br /&gt;    // two.c&lt;br /&gt;&lt;br /&gt;    struct Capri                // Conflicting declaration&lt;br /&gt;    {&lt;br /&gt;        float   x;&lt;br /&gt;    }; &lt;br /&gt;C++ deems this invalid, requiring both definitions to consist of the same sequence of tokens.&lt;br /&gt;&lt;br /&gt;C allows definitions of the same function or object in different source files to be composed of different token sequences, provided that they are semantically identical.&lt;br /&gt;&lt;br /&gt;The C++ rules are more strict, requiring the multiple definitions to be composed of identical token sequences. Thus the following code, which contains multiple definitions that are semantically equivalent but syntactically (token-wise) different, is valid in C but invalid in C++:&lt;br /&gt;&lt;br /&gt;    //========================================&lt;br /&gt;    // file1.c&lt;br /&gt;&lt;br /&gt;    struct Waffle               // A declaration&lt;br /&gt;    {&lt;br /&gt;        int     a;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    int syrup(int amt)          // A definition&lt;br /&gt;    {&lt;br /&gt;        return amt*2;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //========================================&lt;br /&gt;    // file2.c - Valid C, but invalid C++&lt;br /&gt;&lt;br /&gt;    typedef int     IType;&lt;br /&gt;&lt;br /&gt;    struct Waffle               // Equivalent declaration,&lt;br /&gt;    {                           // but a different token sequence&lt;br /&gt;        IType   a;&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    IType syrup(IType quant)    // Equivalent definition,&lt;br /&gt;    {                           // but a different token sequence&lt;br /&gt;        return (quant*2);&lt;br /&gt;    } &lt;br /&gt;[C99: §6.9.2, J.2] &lt;br /&gt;[C++98: §3.2, C.1.2.3.1]&lt;br /&gt;&lt;br /&gt;_Pragma keyword&lt;br /&gt;C99 provides the _Pragma keyword, which operates in a similar fashion to the #pragma preprocessor directive. For example, these two constructs are equivalent:&lt;br /&gt;&lt;br /&gt;    #pragma FLT_ROUND_INF   // Preprocessor pragma&lt;br /&gt;&lt;br /&gt;    _Pragma(FLT_ROUND_INF)  // Pragma statement&lt;br /&gt;C++ does not support the _Pragma keyword.&lt;br /&gt;&lt;br /&gt;(This feature is likely to be provided as an extension by many C++ compilers.)&lt;br /&gt;&lt;br /&gt;[C99: §5.1.1.2, 6.10.6, 6.10.9] &lt;br /&gt;[C++98: §16.6]&lt;br /&gt;&lt;br /&gt;Predefined identifiers&lt;br /&gt;C99 provides a predefined identifier, __func__, which acts like a string literal containing the name of the enclosing function. For example:&lt;br /&gt;&lt;br /&gt;    int incr(int a)&lt;br /&gt;    {&lt;br /&gt;        fprintf(dbgf, "%s(%d)\n", __func__, a);&lt;br /&gt;        return ++a;&lt;br /&gt;    } &lt;br /&gt;(While this feature is likely to be provided as an extension by many C++ compilers, it is unclear what its value would be, especially for member functions within nested template classes declared within nested namespaces.)&lt;br /&gt;&lt;br /&gt;[C99: §6.4.2.2, 7.2.1.1, J.2] &lt;br /&gt;Reserved keywords in C99&lt;br /&gt;C99 has a few reserved keywords that are not recognized by C++:&lt;br /&gt;&lt;br /&gt;restrict&lt;br /&gt;_Bool&lt;br /&gt;_Complex&lt;br /&gt;_Imaginary&lt;br /&gt;_Pragma&lt;br /&gt;This will cause problems when C code containing these tokens is compiled as C++. For example:&lt;br /&gt;&lt;br /&gt;    extern int   set_name(char *restrict n); &lt;br /&gt;[C99: §6.4.1, 6.7.2, 6.7.3, 6.7.3.1, 6.10.9, 7.3.1, 7.16, A.1.2] &lt;br /&gt;[C++98: §2.11]&lt;br /&gt;&lt;br /&gt;Reserved keywords in C++&lt;br /&gt;C++ has a few keywords that are not recognized by C99:&lt;br /&gt;&lt;br /&gt;bool mutable this&lt;br /&gt;catch namespace throw&lt;br /&gt;class new true&lt;br /&gt;const_cast operator try&lt;br /&gt;delete private typeid&lt;br /&gt;dynamic_cast protected typename&lt;br /&gt;explicit public using&lt;br /&gt;export reinterpret_cast virtual&lt;br /&gt;false static_cast wchar_t&lt;br /&gt;friend template &lt;br /&gt;C++ also specifically reserves the asm keyword, which may or may not be reserved in C implementations.&lt;br /&gt;&lt;br /&gt;C code is free to use these keywords as identifiers and macro names. This will cause problems when C code containing these tokens is compiled as C++. For example:&lt;br /&gt;&lt;br /&gt;    extern int   try(int attempt);&lt;br /&gt;    extern void  frob(struct template *t, bool delete); &lt;br /&gt;[C99: §6.4.1] &lt;br /&gt;[C++98: §2.11]&lt;br /&gt;&lt;br /&gt;restrict keyword&lt;br /&gt;C99 supports the restrict keyword, which allows for certain optimizations involving pointers. For example:&lt;br /&gt;&lt;br /&gt;    void copy(int *restrict d, const int *restrict s, int n)&lt;br /&gt;    {&lt;br /&gt;        while (n-- &gt; 0)&lt;br /&gt;            *d++ = *s++;&lt;br /&gt;    } &lt;br /&gt;C++ does not recognize this keyword.&lt;br /&gt;&lt;br /&gt;A simple work-around for code that is meant to be compiled as either C or C++ is to use a macro for the restrict keyword:&lt;br /&gt;&lt;br /&gt;    #ifdef __cplusplus&lt;br /&gt;     #define restrict    /* nothing */&lt;br /&gt;    #endif &lt;br /&gt;(This feature is likely to be provided as an extension by many C++ compilers. If it is, it is also likely to be allowed as a reference modifier as well as a pointer modifier.)&lt;br /&gt;&lt;br /&gt;[C99: §6.2.5, 6.4.1, 6.7.3, 6.7.3.1, 7, A.1.2, J.2] &lt;br /&gt;[C++98: §2.11]&lt;br /&gt;&lt;br /&gt;Returning void&lt;br /&gt;C++ allows functions of return type void to explicitly return expressions of type void. C does not allow void functions to return any kind of expression.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;    void foo(someType expr)&lt;br /&gt;    {&lt;br /&gt;        ...&lt;br /&gt;        return (void)expr;      // Valid C++, invalid C&lt;br /&gt;    } &lt;br /&gt;This is allowed in C++ primarily to allow template functions to accept any function return type, including void, as a template parameter. For example:&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;    template &lt;typename T&gt;&lt;br /&gt;    T bar(someType expr)&lt;br /&gt;    {&lt;br /&gt;        ...&lt;br /&gt;        return (T)expr;         // Valid even if T is void&lt;br /&gt;    } &lt;br /&gt;[C99: §6.8.6.4] &lt;br /&gt;[C++98: §3.9.1, 6.6.3]&lt;br /&gt;&lt;br /&gt;static linkage&lt;br /&gt;Both C and C++ allow objects and functions to have static file linkage, also known as internal linkage. C++, however, deems this as deprecated practice, preferring the use of unnamed namespaces instead. (C++ objects and functions declared within unnamed namespaces have external linkage unless they are explicitly declared static. C++ deems the use of static specifiers on objects or function declarations within namespace scope as deprecated.)&lt;br /&gt;&lt;br /&gt;While it is not a problem for C code compiled under C++98 rules, it may become a problem in a future revision of the C++ language. For example, the following fragment uses the deprecated static feature:&lt;br /&gt;&lt;br /&gt;    // C and C++ code&lt;br /&gt;&lt;br /&gt;    static int  bufsize = 1024;&lt;br /&gt;    static int  counter = 0;&lt;br /&gt;&lt;br /&gt;    static long square(long x)&lt;br /&gt;    {&lt;br /&gt;        return (x * x);&lt;br /&gt;    } &lt;br /&gt;The preferred way of doing this in C++ is:&lt;br /&gt;&lt;br /&gt;    // C++ code&lt;br /&gt;&lt;br /&gt;    namespace /*unnamed*/&lt;br /&gt;    {&lt;br /&gt;        static int  bufsize = 1024;&lt;br /&gt;        static int  counter = 0;&lt;br /&gt;&lt;br /&gt;        static long square(long x)&lt;br /&gt;        {&lt;br /&gt;            return (x * x);&lt;br /&gt;        } &lt;br /&gt;}&lt;br /&gt;(Note that the use of the static specifiers is unnecessary.)&lt;br /&gt;&lt;br /&gt;A possible work-around is to use preprocessor macros and wrappers:&lt;br /&gt;&lt;br /&gt;    // C and C++ code&lt;br /&gt;&lt;br /&gt;    #ifdef __cplusplus&lt;br /&gt;     #define STATIC  static&lt;br /&gt;    #endif&lt;br /&gt;&lt;br /&gt;    #ifdef __cplusplus&lt;br /&gt;    namespace /*unnamed*/&lt;br /&gt;    {&lt;br /&gt;    #endif&lt;br /&gt;&lt;br /&gt;    STATIC int  bufsize = 1024;&lt;br /&gt;    STATIC int  counter = 0;&lt;br /&gt;&lt;br /&gt;    STATIC long square(long x)&lt;br /&gt;    {&lt;br /&gt;        return (x * x);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    #ifdef __cplusplus&lt;br /&gt;    }&lt;br /&gt;    #endif &lt;br /&gt;[C99: §6.2.2, 6.2.4, 6.7.1, 6.9, 6.9.1, 6.9.2, 6.11.2] &lt;br /&gt;[C++98: §3.3.5, 3.5, 7.3.1, 7.3.1.1, D.2]&lt;br /&gt;&lt;br /&gt;String initializers&lt;br /&gt;C allows character arrays to be initialized with string constants. It also allows a string constant initializer to contain exactly one more character than the array it initializes, i.e., the implicit terminating null character of the string may be ignored. For example:&lt;br /&gt;&lt;br /&gt;    char  name1[] =  "Harry";   // Array of 6 char&lt;br /&gt;&lt;br /&gt;    char  name2[6] = "Harry";   // Array of 6 char&lt;br /&gt;&lt;br /&gt;    char  name3[] =  { 'H', 'a', 'r', 'r', 'y', '\0' };&lt;br /&gt;                                // Same as 'name1' initialization&lt;br /&gt;&lt;br /&gt;    char  name4[5] = "Harry";   // Array of 5 char, no null char &lt;br /&gt;C++ also allows character arrays to be initialized with string constants, but always includes the terminating null character in the initialization. Thus the last initializer (name4) in the example above is invalid in C++.&lt;br /&gt;&lt;br /&gt;[C99: §6.7.8] &lt;br /&gt;[C++98: §8.5, 8.5.2]&lt;br /&gt;&lt;br /&gt;String literals are const&lt;br /&gt;In C, string literals have type char[n], but are not modifiable (i.e., attempting to modify the contents of a string literal is undefined behavior).&lt;br /&gt;&lt;br /&gt;In C++, string literals have type const char[n] and are also not modifiable.&lt;br /&gt;&lt;br /&gt;When a string literal is used in an expression (or passed to a function), both C and C++ implicit convert it into a pointer of type char *. (The C++ conversion is considered to be two conversions, the first being an array-to-pointer conversion from type const char[n] to type const char *, and the second being a qualification conversion to type char *.)&lt;br /&gt;&lt;br /&gt;The following code is valid in both C and C++.&lt;br /&gt;&lt;br /&gt;    extern void  frob(char *s);&lt;br /&gt;                        // Argument is not const char *&lt;br /&gt;&lt;br /&gt;    void foo(void)&lt;br /&gt;    {&lt;br /&gt;        frob("abc");    // Valid in both C and C++,&lt;br /&gt;                        // since literal converts to char *&lt;br /&gt;    } &lt;br /&gt;This language feature does not present an incompatibility between C99 and C++98. However, the implicit conversion has been deprecated in C++ (presumably to be replaced by a single implicit conversion to type const char *), which means that a future revision of C++ may no longer accept the code above as valid code.&lt;br /&gt;&lt;br /&gt;[C99: §6.3.2.1, 6.4.5, 6.5.1, 6.7.8] &lt;br /&gt;[C++98: §2.13.4, 4.2, D.4]&lt;br /&gt;&lt;br /&gt;Structures declared in function prototypes&lt;br /&gt;C allows struct, union, and enum types to be declared within function prototype scope, e.g.:&lt;br /&gt;&lt;br /&gt;    extern void  foo(const struct info { int typ; int sz; } *s);&lt;br /&gt;&lt;br /&gt;    int bar(struct point { int x, y; } pt)&lt;br /&gt;    { ... } &lt;br /&gt;C also allows structure types to be declared as function return types, as in:&lt;br /&gt;&lt;br /&gt;    extern struct pt { int x; }  pos(void); &lt;br /&gt;C++ does not allow either of these, since the scope of the structure declared in this fashion does not extend outside the function declaration or definition, making it impossible to define objects of that structure type which could be passed as arguments to the function or to assign function return values into objects of that type.&lt;br /&gt;&lt;br /&gt;Both C and C++ allow declarations of incomplete structure types within function prototypes and as function return types, though:&lt;br /&gt;&lt;br /&gt;    void  frob(struct sym *s);  // Okay, pointer to incomplete type&lt;br /&gt;    struct typ *  fraz(void);   // Ditto &lt;br /&gt;[C99: §6.2.1, 6.7.2.3, 6.7.5.3, I] &lt;br /&gt;[C++98: §3.3.1, 3.3.3, 8.3.5, C.1.6.8.3.5]&lt;br /&gt;&lt;br /&gt;Type-generic math functions&lt;br /&gt;C99 supports type-generic mathematical functions. These are functions that are essentially overloaded on the three floating-point types (float, double, and long double) and the three complex floating-point types (complex float, complex double, and complex long double). To use them, the header file &lt;tgmath.h&gt; must be included; the functions are defined as macros, presumably replaced by implementation-defined names.&lt;br /&gt;&lt;br /&gt;For example, the following is one possible implementation of the type-generic functions:&lt;br /&gt;&lt;br /&gt;    /* Equivalent &lt;tgmath.h&gt; contents:&lt;br /&gt;    * extern float                sin(float x);&lt;br /&gt;    * extern double               sin(double x);&lt;br /&gt;    * extern long double          sin(long double x);&lt;br /&gt;    * extern float complex        sin(float complex x);&lt;br /&gt;    * extern double complex       sin(double complex x);&lt;br /&gt;    * extern long double complex  sin(long double complex x);&lt;br /&gt;    * etc...&lt;br /&gt;    */&lt;br /&gt;&lt;br /&gt;    // Macro definitions&lt;br /&gt;    #define sin  __tg_sin       // Built-in compiler symbol&lt;br /&gt;    #define cos  __tg_cos       // Built-in compiler symbol&lt;br /&gt;    #define tan  __tg_tan       // Built-in compiler symbol&lt;br /&gt;    etc... &lt;br /&gt;C++ can also provide type-generic functions, since it is quite capable of providing multiple overloaded function definitions.&lt;br /&gt;&lt;br /&gt;(Support for type-generic mathematical functions might be provided by many C++ implementations as an extension, although the exact nature of such generic/overloaded functions would most likely differ substantially from the corresponding C99 implementation. In particular, pointers to type-generic functions would probably behave differently.)&lt;br /&gt;&lt;br /&gt;[C99: §7.22] &lt;br /&gt;[C++98: §13, 13.1, 13.3.1, 13.3.2, 13.3.3]&lt;br /&gt;&lt;br /&gt;Typedefs versus type tags&lt;br /&gt;C requires type tags to be preceded by the struct, union, or enum keyword.&lt;br /&gt;&lt;br /&gt;C++ treats type tags as implicit typedef names.&lt;br /&gt;&lt;br /&gt;Thus the following code is valid C but invalid C++:&lt;br /&gt;&lt;br /&gt;    // Valid C, invalid C++&lt;br /&gt;&lt;br /&gt;    typedef int  type;&lt;br /&gt;&lt;br /&gt;    struct type&lt;br /&gt;    {&lt;br /&gt;        type            memb;   // int&lt;br /&gt;        struct type *   next;   // struct pointer&lt;br /&gt;    };&lt;br /&gt;&lt;br /&gt;    void foo(type t, int i)&lt;br /&gt;    {&lt;br /&gt;        int          type;&lt;br /&gt;        struct type  s;&lt;br /&gt;&lt;br /&gt;        type = i + t + sizeof(type);&lt;br /&gt;        s.memb = type;&lt;br /&gt;    } &lt;br /&gt;This difference in the treatment of typedefs can also lead to code that is valid as both C and C++, but which has different semantic behavior. For example:&lt;br /&gt;&lt;br /&gt;    int  sz = 80;&lt;br /&gt;&lt;br /&gt;    int size(void)&lt;br /&gt;    {&lt;br /&gt;        struct sz&lt;br /&gt;        { ... };&lt;br /&gt;&lt;br /&gt;        return sizeof(sz);      // sizeof(int) in C,&lt;br /&gt;                                // sizeof(struct sz) in C++&lt;br /&gt;    } &lt;br /&gt;[C99: §6.2.1, 6.2.3, 6.7, 6.7.2.1, 6.7.2.2, 6.7.2.3] &lt;br /&gt;[C++98: §3.1, 3.3.1, 3.3.7, 3.4, 3.4.4, 3.9, 7.1.3, 7.1.5, 7.1.5.2, 9.1]&lt;br /&gt;&lt;br /&gt;Variable-argument function declarators&lt;br /&gt;C90 syntax allows a trailing ellipsis in the parameter list of a function declarator, which specifies that the function can take zero or more additional arguments after the last named parameter.&lt;br /&gt;&lt;br /&gt;C++ also allows variable function argument lists, but provides two syntactical forms for this feature.&lt;br /&gt;&lt;br /&gt;    /* Variable-argument function declarations */&lt;br /&gt;    int  foo(int a, int b, ...);      // Valid C++ and C&lt;br /&gt;    int  bar(int a, int b ...);       // Valid C++, invalid C &lt;br /&gt;[C99: §6.7.5] &lt;br /&gt;[C++98: §8.3.5]&lt;br /&gt;&lt;br /&gt;Variable-argument preprocessor function macros&lt;br /&gt;C99 supports preprocessor function macros that may take a variable number of arguments. Such macros are defined with a trailing '...' token in their parameter lists, and may use the __VA_ARGS__ reserved identifier in their replacement text.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;    #define DEBUGF(f,...) \&lt;br /&gt;        (fprintf(dbgf, "%s(): ", f), fprintf(dbgf, __VA_ARGS__))&lt;br /&gt;&lt;br /&gt;    #define DEBUGL(...) \&lt;br /&gt;        fprintf(dbgf, __VA_ARGS__)&lt;br /&gt;&lt;br /&gt;    int incr(int *a)&lt;br /&gt;    {&lt;br /&gt;        DEBUGF("incr", "before: a=%d\n", *a);&lt;br /&gt;        (*a)++;&lt;br /&gt;        DEBUGL("after: a=%d\n", *a);&lt;br /&gt;        return (*a);&lt;br /&gt;    } &lt;br /&gt;C++ does not provide this feature.&lt;br /&gt;&lt;br /&gt;(This feature is likely to be provided as an extension by many C++ compilers.)&lt;br /&gt;&lt;br /&gt;[C99: §6.10.3, 6.10.3.1, 6.10.3.4, 6.10.3.5] &lt;br /&gt;[C++98: §16.3, 16.3.1]&lt;br /&gt;&lt;br /&gt;Variable-length arrays (VLAs)&lt;br /&gt;C99 supports variable-length arrays, which are arrays of automatic storage whose size is determined dynamically at program execution time. For example:&lt;br /&gt;&lt;br /&gt;    size_t sum(int sz)&lt;br /&gt;    {&lt;br /&gt;        float   arr[sz];      // VLA, dynamically allocated&lt;br /&gt;&lt;br /&gt;        while (sz-- &gt; 0)&lt;br /&gt;            arr[sz] = sz;&lt;br /&gt;        return sizeof(arr);   // Evaluated at runtime&lt;br /&gt;    } &lt;br /&gt;C99 also provides new declaration syntax for function parameters of VLA types, allowing a variable identifier or a '*' to occur within the brackets of an array function parameter declaration in place of a constant integer size expression. The following example illustrates the syntax involved in passing VLAs to a function:&lt;br /&gt;&lt;br /&gt;    extern float  sum_square(int n, float a[*]);&lt;br /&gt;&lt;br /&gt;    float sum_cube(int n, float a[m])&lt;br /&gt;    {&lt;br /&gt;        ...&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void add_seq(int n)&lt;br /&gt;    {&lt;br /&gt;        float   x[n];       // VLA&lt;br /&gt;        float   s;&lt;br /&gt;&lt;br /&gt;        ...&lt;br /&gt;        s = sum_square(n, x) + sum_cube(n, x);&lt;br /&gt;        ...&lt;br /&gt;    } &lt;br /&gt;VLA function parameter declarations using a '*' can only appear in function declarations (with prototypes) and not in function definitions. Note that this capability also affects the way sizeof expressions are evaluated.&lt;br /&gt;&lt;br /&gt;C++ does not support VLAs.&lt;br /&gt;&lt;br /&gt;[C99: §6.7.5, 6.7.5.2, 6.7.5.3, 6.7.6] &lt;br /&gt;[C++98: §8.3.4, 8.3.5, 8.4]&lt;br /&gt;&lt;br /&gt;Void pointer assignments&lt;br /&gt;C allows a pointer to void (void *) value to be assigned to an object of any other pointer type without requiring a cast. This allows such things as assigning the return value of malloc() to a pointer variable without the need for an explicit cast.&lt;br /&gt;&lt;br /&gt;C++ does not allow assigning a pointer to void directly to an object of any other pointer type without an explicit cast. This is considered a breach of type safety, so an explicit cast is required. Thus the following code is valid C but invalid C++:&lt;br /&gt;&lt;br /&gt;    extern void *  malloc(size_t n);&lt;br /&gt;&lt;br /&gt;    struct object * allocate(void)&lt;br /&gt;    {&lt;br /&gt;        struct object *  p;&lt;br /&gt;&lt;br /&gt;        p = malloc(sizeof(struct object));&lt;br /&gt;                            // Direct assignment without a cast,&lt;br /&gt;                            // valid C, invalid C++&lt;br /&gt;        return p;&lt;br /&gt;    } &lt;br /&gt;(Both languages allow values of any pointer type to be assigned to objects of type pointer to void without requiring an explicit cast.&lt;br /&gt;&lt;br /&gt;    void *  vp;&lt;br /&gt;    Type *  tp;&lt;br /&gt;&lt;br /&gt;    vp = tp;    // No explicit cast needed,&lt;br /&gt;                // valid C and C++ &lt;br /&gt;Such usage is considered type safe.)&lt;br /&gt;&lt;br /&gt;(Note that there are situations in C++ where pointers are implicitly converted to type pointer to void, such as when comparing a pointer of type pointer to void to another pointer of a different type, but such situations are considered type safe since no pointer objects are modified in the process.)&lt;br /&gt;&lt;br /&gt;[C99: §6.2.5, 6.3.2.3, 6.5.15, 6.5.16, 6.5.16.1] &lt;br /&gt;[C++98: §3.8, 3.9.2, 4.10, 5.4, 5.9, 5.10, 5.16, 5.17, 13.3.3.2]&lt;br /&gt;&lt;br /&gt;Wide character type&lt;br /&gt;C provides a wide character type, wchar_t, that is capable of holding a single wide character from an extended character set. This type is defined in the standard header files &lt;stddef.h&gt;, &lt;stdlib.h&gt;, and &lt;wchar.h&gt;.&lt;br /&gt;&lt;br /&gt;C++ also provides a wchar_t type, but it is a reserved keyword just like int. No header file is required to enable its definition.&lt;br /&gt;&lt;br /&gt;This means that C code that does not include any of the standard header files listed above is free to use wchar_t as an identifier or macro name; such code will not compile as C++ code.&lt;br /&gt;&lt;br /&gt;    // Does not #include &lt;stddef.h&gt;, &lt;stddef.h&gt;, or &lt;wchar.h&gt;&lt;br /&gt;&lt;br /&gt;    typedef unsigned short  wchar_t;&lt;br /&gt;&lt;br /&gt;    wchar_t readwc(void)&lt;br /&gt;    {&lt;br /&gt;        ...&lt;br /&gt;    } &lt;br /&gt;The recommended practice is therefore to use the wchar_t type only for its special meaning, and only after including &lt;stddef.h&gt;, &lt;stdlib.h&gt;, or &lt;wchar.h&gt;.&lt;br /&gt;&lt;br /&gt;(It is likely that a &lt;wchar.h&gt; header will be provided by most C++ implementations as an extension. Some C++ compilers might also provide an empty &lt;cwchar&gt; header as an extension.)&lt;br /&gt;&lt;br /&gt;[C99: §3.7.3, 6.4.4.4, 6.4.5, 7.1.2, 7.17, 7.19.1, 7.20, 7.24] &lt;br /&gt;[C++98: §2.11, 2.13.2, 2.13.4, 3.9.1, 4.5, 7.1.5.2]&lt;br /&gt;&lt;br /&gt;References&lt;br /&gt;&lt;br /&gt;[C89]&lt;br /&gt;Programming Languages - C &lt;br /&gt;ANSI/ISO 9899:1989, 1989, &lt;br /&gt;Available at www.ansi.org.&lt;br /&gt;[C90]&lt;br /&gt;Programming Languages - C &lt;br /&gt;(with ISO amendments) &lt;br /&gt;ISO/IEC 9899:1990, 1990, ISO/IEC JTC1/SC22/WG14. &lt;br /&gt;Available at www.ansi.org.&lt;br /&gt;[C99]&lt;br /&gt;Programming Languages - C &lt;br /&gt;ISO/IEC 9899:1999, 1999, ISO/IEC JTC1/SC22/WG14. &lt;br /&gt;Available at www.ansi.org.&lt;br /&gt;[C++98]&lt;br /&gt;Programming Languages - C++ &lt;br /&gt;ISO/IEC 14882:1998(E), 1998-09-01, 1st ed., ISO/IEC JTC1/SC22. &lt;br /&gt;Available at www.ansi.org.&lt;br /&gt;&lt;br /&gt;[STR]&lt;br /&gt;The C++ Programming Language, Appendix B - Compatibility &lt;br /&gt;Bjarne Stroustrup. &lt;br /&gt;Third ed., 1997, AT&amp;T. &lt;br /&gt;Available in PDF format at www.research.att.com/~bs/3rd_compat.pdf.&lt;br /&gt;Acknowledgments&lt;br /&gt;&lt;br /&gt;My thanks to the the people who gave helpful comments on early drafts of this document, especially to the following individuals who emailed me suggestions and corrections or posted comments on the comp.std.c and comp.std.c++ newsgroups:&lt;br /&gt;&lt;br /&gt;Nelson H. F. Beebe, beebe@math.utah.edu&lt;br /&gt;Greg Brewer, greg@brewer.net.&lt;br /&gt;David Capshaw, capshaw@metrowerks.com.&lt;br /&gt;Steve Clamage, clamage@eng.sun.com.&lt;br /&gt;Yaakov Eisenberg, Yaakov@Digisoft.com.&lt;br /&gt;Clive D. W. Feather, clive@demon.net.&lt;br /&gt;Francis Glassborow, francisG@robinton.demon.co.uk.&lt;br /&gt;Doug Gwyn, gwyn@arl.mil or dagwyn@home.com.&lt;br /&gt;James Kanze, James.Kanze@dresdner-bank.com.&lt;br /&gt;Matt Seitz, mseitz@snapserver.com.&lt;br /&gt;Vesa A J Karvonen, vkarvone@cc.helsinki.fi.&lt;br /&gt;Nick Maclaren, nmm1@cam.ac.uk.&lt;br /&gt;Joe Maun, reply_to@yahoo.com.&lt;br /&gt;Gabriel Netterdag, gabriel.netterdag@quidsoft.se.&lt;br /&gt;Cesar Quiroz, Cesar.Quiroz@CoWare.com.&lt;br /&gt;Bjarne Stroustrup, bs@research.att.com and www.research.att.com/~bs.&lt;br /&gt;Keith Thompson, kst@cts.com.&lt;br /&gt;Martin van Loewis, loewis@informatik.hu-berlin.de.&lt;br /&gt;Daniel Villeneuve, danielv@crt.umontreal.ca.&lt;br /&gt;Bill Wade, bill.wade@stoner.com.&lt;br /&gt;Revision History&lt;br /&gt;&lt;br /&gt;1.0, 2001-08-05&lt;br /&gt;Completed revision.&lt;br /&gt;0.12, 2000-11-13&lt;br /&gt;Minor corrections made. &lt;br /&gt;Better HTML anchor names.&lt;br /&gt;0.11, 2000-09-20&lt;br /&gt;Sixth public review revision. &lt;br /&gt;Added ISO section reference numbers to most of the sections.&lt;br /&gt;0.10, 2000-07-30&lt;br /&gt;Sixth public review revision.&lt;br /&gt;0.09, 2000-02-17&lt;br /&gt;Fifth public review revision, still incomplete.&lt;br /&gt;0.08, 1999-10-31&lt;br /&gt;Fourth public review revision, still incomplete. &lt;br /&gt;Minor corrections made. &lt;br /&gt;Changed "C9X" to "C99" after the ratification of ISO C-1999.&lt;br /&gt;0.07, 1999-10-13&lt;br /&gt;Third public review revision, still incomplete.&lt;br /&gt;0.06, 1999-10-05&lt;br /&gt;Second public review revision, still incomplete.&lt;br /&gt;0.05, 1999-09-14&lt;br /&gt;First public review revision, still incomplete.&lt;br /&gt;0.00, 1999-08-24&lt;br /&gt;First attempt, incomplete.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Reference:&lt;br /&gt;this chapter is Taken from&lt;br /&gt;Copyright ©1999-2001 by David R. Tribble, all rights reserved.&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-727434298250664138?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/727434298250664138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/c-vs-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/727434298250664138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/727434298250664138'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/c-vs-c.html' title='C Vs C++'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-1497006699180398837</id><published>2011-01-20T08:17:00.000-08:00</published><updated>2011-01-20T08:32:52.471-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Regards---the_awanish'/><title type='text'>YOUR OWN PASSWORD PROTECTED FOLDER</title><content type='html'>Have you ever had the need for a protected folder, but didn't want to use Window's basic security? Then create your own!&lt;br /&gt;&lt;br /&gt;COPY THE FOLLOWING IN NOTEPAD (NOTEPAD WILL BE IN YOUR FOLDER WHICH U WANT TO LOCK)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@ECHO OFF&lt;br /&gt;title Folder Private&lt;br /&gt;if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto :UNLOCK&lt;br /&gt;if NOT EXIST Private goto :MDLOCKER&lt;br /&gt; :CONFIRM&lt;br /&gt;echo Are you sure you want to lock the folder(Y/N)&lt;br /&gt;set/p "cho=&gt;"&lt;br /&gt;if %cho%==Y goto :LOCK&lt;br /&gt;if %cho%==y goto :LOCK&lt;br /&gt;if %cho%==n goto :END&lt;br /&gt;if %cho%==N goto :END&lt;br /&gt;echo Invalid choice.&lt;br /&gt;goto :CONFIRM&lt;br /&gt; :LOCK&lt;br /&gt;ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"&lt;br /&gt;attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"&lt;br /&gt;echo Folder locked&lt;br /&gt;goto :End&lt;br /&gt; :UNLOCK&lt;br /&gt;echo Enter password to unlock folder&lt;br /&gt;set/p "pass=&gt;"&lt;br /&gt;if NOT %pass%== passwordSELECT goto :FAIL&lt;br /&gt;attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"&lt;br /&gt;ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private&lt;br /&gt;echo Folder Unlocked successfully&lt;br /&gt;goto :End&lt;br /&gt; :FAIL&lt;br /&gt;echo Invalid password&lt;br /&gt;goto :end&lt;br /&gt; :MDLOCKER&lt;br /&gt;md Private&lt;br /&gt;echo Private created successfully&lt;br /&gt;goto :End&lt;br /&gt; :End&lt;br /&gt;&lt;br /&gt;3Where it says 'passwordSELECT', change it to your desired password&lt;br /&gt;4Save the file with name locker.bat and as all types&lt;br /&gt;5Close the window&lt;br /&gt;6Run the file and you will get a folder named Private&lt;br /&gt;7Move all the things you want to hide and again run locker.bat&lt;br /&gt;8Follow the Instructions And you are done no one can access your folder without password&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-1497006699180398837?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/1497006699180398837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/your-own-password-protected-folder.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/1497006699180398837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/1497006699180398837'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/your-own-password-protected-folder.html' title='YOUR OWN PASSWORD PROTECTED FOLDER'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-1466241149212879814</id><published>2011-01-20T08:03:00.000-08:00</published><updated>2011-01-20T08:17:12.554-08:00</updated><title type='text'>FUNNY PROVE of (1=2)</title><content type='html'>Let ... a = b&lt;br /&gt;&lt;br /&gt;Multiply both sides by 'a'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Add a2 to both sides&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Subtract 2ab from both side&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cancel the common factor from both sides&lt;br /&gt;&lt;br /&gt;Hence 2=1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-1466241149212879814?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/1466241149212879814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/funny-prove-of-12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/1466241149212879814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/1466241149212879814'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/funny-prove-of-12.html' title='FUNNY PROVE of (1=2)'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-2539451284291300774</id><published>2011-01-18T08:53:00.000-08:00</published><updated>2011-01-18T09:06:08.427-08:00</updated><title type='text'>Follow the links</title><content type='html'>&lt;a href="http://r4r.co.in/"&gt;http://r4r.co.in/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cpp-home.com"&gt;http://www.cpp-home.com &lt;/a&gt;&lt;br /&gt;&lt;a href="http://java.itags.org"&gt;http://java.itags.org&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.dotnetheaven.com "&gt;http://www.dotnetheaven.com&lt;/a&gt;&lt;br /&gt;&lt;a href="http://e-sparc.com"&gt; http://e-sparc.com&lt;/a&gt;&lt;br /&gt;&lt;a href "http://www.tutorialspoint.com"&gt; &lt;br /&gt;http://www.tutorialspoint.com&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Best blog for simple maths tricks...&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.tutorialspoint.com"&gt;http://objectivemaths.blogspot.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-2539451284291300774?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/2539451284291300774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/follow-links.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/2539451284291300774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/2539451284291300774'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/follow-links.html' title='Follow the links'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-83794389292514001</id><published>2011-01-18T08:41:00.000-08:00</published><updated>2011-01-18T08:45:59.810-08:00</updated><title type='text'>Data Types(C# continued....)</title><content type='html'>Net C# Data Types&lt;br /&gt;      Data is physically stored inside cells of memory. This memory could be physical memory (Hard disk) or logical memory (RAM). Any cell of memory is represented with a unique address. This address is more than some combination of numbers or symbols.&lt;br /&gt;C# language provides for practically all the data types. These types can be divided in three categories: value types, reference types and pointer types.&lt;br /&gt;&lt;br /&gt;There are some more basic concepts to be learnt before the discussion of the data types. This is about variables and constants. A Variable is a named cell of memory used for data storage. A Variable value can be changed anytime. Every variable must have a type and this type must be set before it is used. Qualifying a variable with a type is called as declaration of variable. The type of a variable is the most important aspect and it defines the behavior of variable. All variables can be divided into seven main categories depending on the context of usage:&lt;br /&gt;1. Static variables&lt;br /&gt;2. Variable of instance&lt;br /&gt;3. Array's elements&lt;br /&gt;4. Parameters given by reference&lt;br /&gt;5. Parameters given by value&lt;br /&gt;6. Returned values&lt;br /&gt;7. Local variables.&lt;br /&gt;Static Variables will be alive throughout the life of a program. It can be declared using static modifier.&lt;br /&gt;An Instance variable is a variable declared without static modifier. Usually it is declared inside a class or structure definition.&lt;br /&gt;Parameter Values can be viewed as input parameters into methods:&lt;br /&gt;public static void Sum(int a, int b)&lt;br /&gt;{&lt;br /&gt;   Console.WriteLine("The sum of elements {0} and {1} is {2}",a,b,a + b);&lt;br /&gt;}&lt;br /&gt;This code writes in console values of variables a, b and their summary value. Now if the values of these parameters are modified inside the method, this change will not be reflected inside the main function. It is because the compiler creates copies of them when it passes them as value types. This ensures that their original values are not modified.&lt;br /&gt;Instead if one wants to modify the parameter variables inside the function, C# has something called Reference variables.Reference variables also have a modifier out which can be used before their type. Look at the following example:&lt;br /&gt;public static void SumRef(ref int a, ref int b)&lt;br /&gt;{&lt;br /&gt;   a = 4;&lt;br /&gt;   b = 6;&lt;br /&gt;   Console.WriteLine("The sume of elements {0} and {1} is {2}",a,b,a + b);&lt;br /&gt;}&lt;br /&gt;Now this method modifies the value of variables a and b with values 4 and 6. These values are retained even after the execution of the function gets completed.&lt;br /&gt;If the parameters need to be returned then they can be qualified with out modifier or as returned parameter in method definition. Here is an example of both of them, in which both of them return the same value:&lt;br /&gt;public static int SumOut(int a, int b, out int sum1)&lt;br /&gt;{&lt;br /&gt;sum1 = a+b;&lt;br /&gt;Console.WriteLine("The sum1 of elements {0} and {1} is {2}",a,b,a+b);&lt;br /&gt;return sum1;&lt;br /&gt;}&lt;br /&gt;In main function it must be called in the next manner:&lt;br /&gt;int sume ;&lt;br /&gt;sume = SumeOut(2,2, out sume);&lt;br /&gt;Constants in C#:&lt;br /&gt;Constant type of data cannot be changed. To declare a constant the keyword const is used. An example for the constantdeclaration is: const double PI = 3.1415;&lt;br /&gt;Values types in C#:&lt;br /&gt;Value type stores real data. When the data are queried by different function a local copy of it these memory cells are created. It guarantees that changes made to our data in one function don't change them in some other function. Let see at a simple example:&lt;br /&gt;public class IntClass &lt;br /&gt;{&lt;br /&gt;   public int I = 1;&lt;br /&gt;}&lt;br /&gt;Here we have simple class that contains only one public data field of integer type. Now have a look on its usage in main function:&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;// test class &lt;br /&gt;int i = 10;&lt;br /&gt;int j = i;&lt;br /&gt;j = 11;&lt;br /&gt;IntClass ic1 = new IntClass();&lt;br /&gt;IntClass ic2 = ic1;&lt;br /&gt;ic2.I = 100;&lt;br /&gt;&lt;br /&gt;Console.WriteLine("value of i is {0} and j is {1}",i,j);&lt;br /&gt;Console.WriteLine();&lt;br /&gt;Console.WriteLine("value of ic1.I is {0} and ic2.I is {1}",ic1.I,ic2.I);&lt;br /&gt;Console.WriteLine();&lt;br /&gt;}&lt;br /&gt;Reference Types in C#:&lt;br /&gt;In the above example, assume that First we have two value type i and j. Also assume that the second variable is initialized with the value of the first one. It creates new copy in memory and after it the values of these variables will be next:&lt;br /&gt;i=10;&lt;br /&gt;j = i;&lt;br /&gt;There are a few more things written in the above example for explaining the Reference Types in C#. At first, the variable ic1 of IntClass is created using dynamic memory allocation. Then we initialize the variable ic2 with value of ic1. This makes both the variables ic1 and ic2 referring to the same address. If we change a value of ic2, it automatically changes the value of ic1.&lt;br /&gt;Now, over to the discussions about the important value types used in C#. The category simple types contains some predefined or system types that also are commonly used in other programming languages. It contains integer types: byte, Sbyte, Long, Ulong, Short, Ushort, int, Uint. These common types differs only range of values and sign.&lt;br /&gt;Next simple type is character type. To declare a variable of this type need use keyword char. It can take values of characters or numbers as 16-digit symbol of the type Unicode.&lt;br /&gt;The Boolean type has only two values: true, false. But these values cannot be assigned with a 0 or 1 as in C++ language.&lt;br /&gt;Next category of simple types is floating point types. It contains two types float and double. Float type can get values in range from 1.5*10-45 to 3.4*1038. Double type has range of values from 5.0*10-324 to 1.7*10308.&lt;br /&gt;A structural value types are struct and enum. Struct is a the same as class but it uses real values not references. The following code snippet contains the definition for struct:&lt;br /&gt;Struct Point3D&lt;br /&gt;{&lt;br /&gt;public float m_x;&lt;br /&gt;public float m_y;&lt;br /&gt;public float m_z;&lt;br /&gt;&lt;br /&gt;public float [] GetArray()&lt;br /&gt;{&lt;br /&gt;float [] arr = new float[3];&lt;br /&gt;arr[0] = m_x;&lt;br /&gt;arr[1] = m_y;&lt;br /&gt;arr[2] = m_z;&lt;br /&gt;return arr;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;The above is declaration for a simple structure of real 3D point. As you see a class declaration looks very similar to the struct except that the class also has a constructor.&lt;br /&gt;&lt;br /&gt;   Enumerated types can be used to create some set of identifiers that can have values of simple type. Let us see at example of enum type:&lt;br /&gt;public enum Days&lt;br /&gt;{&lt;br /&gt;Monday, &lt;br /&gt;Tuesday, &lt;br /&gt;Wensday,&lt;br /&gt;Thursday,&lt;br /&gt;Friday,&lt;br /&gt;Saturday,&lt;br /&gt;Sunday&lt;br /&gt;}&lt;br /&gt;In example there are enum that has days of week names. The values of days by default are in range from 0 to 6.&lt;br /&gt;Common types in C#:&lt;br /&gt;Object in C# language is universal; it means that all supported types are derived from it. It contains only a couple of methods: GetType() - returns a type of object, ToString() returns string equivalent of type that called.&lt;br /&gt;Next type is class. It is declared in the same manner as structure type but it has more advanced features.&lt;br /&gt;Interface is an abstract type. It is used only for declaring type with some abstract members. It means members without implementations. Please, have a look at piece of code with a declaration for a simple interface:&lt;br /&gt;interface IRect&lt;br /&gt;{&lt;br /&gt;int Width&lt;br /&gt;{&lt;br /&gt;get;&lt;br /&gt;set;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int Height&lt;br /&gt;{&lt;br /&gt;get;&lt;br /&gt;set;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int CalculateArea();&lt;br /&gt;}&lt;br /&gt;The members of interface can be methods, properties and indexers.&lt;br /&gt;Next reference type to be dealt is delegate. The main goal of delegate usage is encapsulation of methods. It most like at pointers to function in C++.&lt;br /&gt;String is common type that is used in almost all programming languages of high level. An example of string declarationand initialization:&lt;br /&gt;string s = "declaration and init";&lt;br /&gt;The last very used reference type is array. Array it is set of elements that have the same type. Array contains list of references on memory cells and it can contain any amount of members. In C# there are three types of arrays: one-dimensional, two-dimensional and jagged array.&lt;br /&gt;So, this covers almost all types used in C#. All these types can be cast to another type using special rules. An implicit casting can be done with types when values of variables can be converted without losing of any data. There is special type of implicit casting called boxing. This enables us to convert any type to the reference type or to the object type. Boxing example:&lt;br /&gt;// boxing &lt;br /&gt;char ch = 'b';&lt;br /&gt;object obj = ch;&lt;br /&gt;Console.WriteLine("Char value is {0}",ch);&lt;br /&gt;Console.WriteLine("Object value is {0}",obj);&lt;br /&gt;Console.WriteLine();&lt;br /&gt;This piece of code prints the same values of integer type variable and object type variable. The opposite process to the boxing is un-boxing. An example for un-boxing is as follows.&lt;br /&gt;// unboxing &lt;br /&gt;float q = 4.6f;&lt;br /&gt;object ob = q; &lt;br /&gt;Console.WriteLine("Object value is {0}",ob);&lt;br /&gt;float r = (float)ob;&lt;br /&gt;Console.WriteLine("Float value is {0}",r);&lt;br /&gt;So, it is main item of common data type creating and using. All sources are attached. To compile and run it need to run .NET command line. Just type: csc DataTypes.cs. It creates DataTypes.exe that can be run as standard executable file. You can download the sample code here.&lt;br /&gt;&lt;br /&gt;Value and Reference Types&lt;br /&gt;If you know C and C++ then you'll be familiar with the difference between local or auto variables and pointer/reference variables that are created on the heap. It's similar for C# value types and reference types.&lt;br /&gt;The Heap and The Stack&lt;br /&gt;Procedural programming languages that let you to create variables dynamically at run-time use two different areas of Ram for holding variables;. the stack and the heap. The heap is basically all unallocated memory.&lt;br /&gt;The picture shows a rough layout of a program in memory. The first four areas (Program Code, Static Data, Uninitialized Data and Stack) are fixed in size when the application islinked and the heap is what's left over.&lt;br /&gt;This is for each application, but because of the way a CPU virtualizes memory, each application runs in its own space and sees itself as having access to all available ram.&lt;br /&gt;The stack holds value type variables plus return addresses for functions. All numeric types, ints, floats and doubles along with enums, chars, bools and structs are value types.&lt;br /&gt;The heap hold variables created dynamically- known as reference variables and mainly instances of classes or strings. These variables are stored in two places; there's a hidden pointer to the place in the heap where the data is stored.&lt;br /&gt;Another distinction between value and reference type is that a value type is derived fromSystem.ValueType while a reference type is derived from System.Object.&lt;br /&gt;If you assign a value type variable to another then a direct copy of the value is made. But copying a reference type variable just makes a copy of the reference to the variable and does not affect the variable itself. This is like pointers in C and C++. You aren't copying what the pointer points to but making a copy of the pointer itself.&lt;br /&gt;In C++ a struct is just a class with default public access. In C# it is like a class but much more limited and is a value type so is stored on the stack. It is closer to the original use of a struct in C where it was just a place to hold data. A struct cannot inherit from a struct not can it be inherited from.&lt;br /&gt;To confuse matters slightly, a struct can contain constructors, constants, fields, methods, properties, indexers, operators, events, and nested types. A default constructor is provided by the compiler so you can initialize it with constructor type syntax. But you cannot write a default constructor for a struct yourself. Any constructors you write for a struct must have parameters.&lt;br /&gt;Example 1&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;&lt;br /&gt;&lt;br /&gt;namespace ex1&lt;br /&gt;{&lt;br /&gt;class  class_test {&lt;br /&gt;public int a=4;&lt;br /&gt;public int b=2;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class_test(int newa,int newb) {&lt;br /&gt;a = newa;&lt;br /&gt;b = newb;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public override string ToString()  {&lt;br /&gt;return a.ToString() + " " + b.ToString();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;struct struct_test&lt;br /&gt;{&lt;br /&gt;public int a;&lt;br /&gt;public int b;&lt;br /&gt;&lt;br /&gt;public struct_test(int newa,int newb) {&lt;br /&gt;a = newa;&lt;br /&gt;b = newb;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// public override string ToString()  {&lt;br /&gt;//    return a.ToString() + " " + b.ToString();&lt;br /&gt;// }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class ex1&lt;br /&gt;{&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;struct_test t= new struct_test();&lt;br /&gt;struct_test t2= new struct_test(8,7);&lt;br /&gt;struct_test t3;&lt;br /&gt;class_test c1 = new class_test();&lt;br /&gt;Console.WriteLine("t = {0} ", c1);&lt;br /&gt;Console.WriteLine("t = {0} ", t);&lt;br /&gt;Console.WriteLine("t2 = {0} ", t2);&lt;br /&gt;t3 = t;&lt;br /&gt;Console.ReadKey();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This example demonstrates a simple struct type that has two public ints a and b. In a C# struct, everything is private unless explicitly declared public, the opposite of C++.&lt;br /&gt;struct struct_test   {     public int a;     public int b;     public struct_test(int newa,int newb) { // constructor       a = newa;       b = newb;     }     public override string ToString() {       return a.ToString() + " " + b.ToString() ;     }   }&lt;br /&gt;The ToString() function overrides the function object.ToString(). All C# variables can do this. This provides an easy way to print out the value of a variable. By default though, for objects and structs, ToString() returns the name of the variable. You can override it, as I did to provide something more useful.&lt;br /&gt;&lt;br /&gt;Unlike C++, a default constructor is supplied even when you write your own constructor but you aren't forced to call it. The compiler will complain though if you try to use a variable that it knows has not been initialized.&lt;br /&gt;struct_test t= new struct_test() ; // calls the default constructor struct_test t2= new struct_test(8,7) ; // calls the constructor I wrote struct_test t3; // Leaves the object uninitialized&lt;br /&gt;These are three ways of creating an instance of the object as shown above. If you attempt to read any field in t3, the compiler will complain. It's a compile error to read uninitialized variables. The built in default constructor initializes all fields to zero (0 for ints, 0.0 for floats,"" for strings, false for bool) etc.&lt;br /&gt;t3.a = 8; // compiler ok int b= t3.b; // error - accessing uninitialized variable&lt;br /&gt;This line&lt;br /&gt;Console.WriteLine("t2 = {0} ", t2) ;&lt;br /&gt;calls the t2.ToString() function which outputs 8 7.&lt;br /&gt;Why Use Structs?&lt;br /&gt;Because they are somewhat faster than classes at runtime, due to being directly accessed. Rather than use a full class for data structures, a struct is often more appropriate. Just how much faster though is a struct than a class? Example 2 gives an idea.&lt;br /&gt;D&lt;br /&gt;Using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Diagnostics;&lt;br /&gt;&lt;br /&gt;namespace ex1&lt;br /&gt;{&lt;br /&gt;class  class_test {&lt;br /&gt;public int a;&lt;br /&gt;public int b;&lt;br /&gt;&lt;br /&gt;public class_test(int newa,int newb) {&lt;br /&gt;a = newa;&lt;br /&gt;b = newb;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;struct struct_test&lt;br /&gt;{&lt;br /&gt;public int a;&lt;br /&gt;public int b;&lt;br /&gt;&lt;br /&gt;public struct_test(int newa,int newb) {&lt;br /&gt;a = newa;&lt;br /&gt;b = newb;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class ex1&lt;br /&gt;{&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;Stopwatch st = new Stopwatch();&lt;br /&gt;Console.WriteLine("Started");&lt;br /&gt;int total = 0;&lt;br /&gt;st.Start();&lt;br /&gt;for (int i = 0; i &lt; 100000000; i++)&lt;br /&gt;{&lt;br /&gt;struct_test c1 = new struct_test(i,i);&lt;br /&gt;//class_test c1 = new class_test(i, i);&lt;br /&gt;int a = c1.a;&lt;br /&gt;total += a;&lt;br /&gt;}&lt;br /&gt;st.Stop();&lt;br /&gt;Console.WriteLine("Elapsed = {0} Total={1}", st.Elapsed.ToString(),total);&lt;br /&gt;Console.ReadKey();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This loops 100 million times creating an object from either a class or a struct depending on which of the two lines in the loop is commented out. There's a bit of code to copy the value out of the object and total it up, thus ensuring that the object isn't optimized out because it's not used. The execution times are&lt;br /&gt;1. Class 3.6 seconds.&lt;br /&gt;2. Struct 1.4 seconds.&lt;br /&gt;So if you can use a struct rather than a class, do so. It will make a bit of a difference.&lt;br /&gt;&lt;br /&gt;The main reference type is object which is an instance of a class. The other one is string.&lt;br /&gt;The constructor for a reference type allocates memory in the heap and then supplies a reference to this. C# hides the underlying details and prevents the possibility of C/C++ nullpointer problems.&lt;br /&gt;However, unlike a value type, a reference type can be null.&lt;br /&gt;&lt;br /&gt;DExample 3&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;namespace ex1&lt;br /&gt;{ &lt;br /&gt;&lt;br /&gt;    class test&lt;br /&gt;    {&lt;br /&gt;        public int a = 9;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    class ex1&lt;br /&gt;    {&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;            test t=null;&lt;br /&gt;            t.a = 5;&lt;br /&gt;            Console.ReadKey();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;But the compiler will usually stop you doing silly things. Objects in C# are generally easier to work with than in C++.&lt;br /&gt;using System; namespace ex1 {   class test   {       public int a = 9;   }   class ex1   {       static void Main(string[] args)       {       test t=null;           t.a = 5;           Console.ReadKey() ;       }   } }&lt;br /&gt;This compiles and runs, up to the t.a = 5; assignment where it falls over as t is null. The = null makes the compiler happy that t has a value, even if at runtime it's not valid. Try removing the = null and the compiler will flag the error.&lt;br /&gt;&lt;br /&gt;Value types hold data, but reference types i.e. classes are meant to control how applications behave. The use of the two should be distinguished early on. If you usestructs and then later change them to classes, you may introduce some nasty bugs. Why? Because if you pass a struct by value as a function parameter then a copy of it is made in the function, and that copy used. The original struct is left unchanged unless the keyword ref is added to the call and the definition.&lt;br /&gt; public struct t1 {   public int Total; } public static int AddFive( t1 x) {   x.Total += 5;   return x.Total; } &lt;br /&gt;In this example &lt;br /&gt;(Example 4_1)&lt;br /&gt;using System;&lt;br /&gt;&lt;br /&gt;namespace ex1&lt;br /&gt;{      &lt;br /&gt;    class ex1&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        public struct t1&lt;br /&gt;        {&lt;br /&gt;            public int Total;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public static int AddFive( t1 x)&lt;br /&gt;        {&lt;br /&gt;            x.Total+= 5;&lt;br /&gt;            &lt;br /&gt;            return x.Total;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;            t1 t = new t1();&lt;br /&gt;            t.Total = 0;&lt;br /&gt;            int x = AddFive( t);&lt;br /&gt;            Console.WriteLine("x={0}", x);&lt;br /&gt;            Console.WriteLine("total={0}", t.Total);&lt;br /&gt;            Console.ReadKey();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; x is a struct and is passed into AddFive. If x.Totalwas 0 upon entry then AddFive() will return 5 but x.Total will still be 0. Now change t1 to a class and because it is a reference type, x.Total will be 5 when AddFive() exits.&lt;br /&gt;Boxing&lt;br /&gt;Originally from Java, the concept of boxing is about storing a value type variable in a reference variable.&lt;br /&gt; int i = 99; object t=(object)i; Console.WriteLine("Value of t ={0}",(int)t) ; Console.WriteLine("Value of t ={0}",t) ; Console.ReadKey() ; &lt;br /&gt;This wraps the variable i in an object t i.e. inside a box. Remember all types ultimately derive from System.object.&lt;br /&gt;Note - Boxing is a relatively slow process. According to Microsoft it takes 20 times as long as an assignment. This is because an object has to be created, then the valuetype variable copied into it. The opposite is unboxing, which is about four times as slow as assignment.&lt;br /&gt;When would You Use Boxing?&lt;br /&gt;The answer is you wouldn't if you can help it. If C# 1.0 and 1.1, it made possible null value value types (by boxing them as reference types) but with the nullable types in .NET 2.0 that is no longer needed.&lt;br /&gt;In a class there are two types of fields and functions: instance and static. Instance fields are created when an instance of the class is created. Static fields apply only to the class itself. No matter how many instances of a class there are, there is only one instance of that classes' static fields.&lt;br /&gt; Example 4.&lt;br /&gt;This has a class test with a default constructor and a second constructor that copies data from another instance of the class. The private static int field has an id assigned to each instance object as it is created. If you step through the code, when the line&lt;br /&gt; test x2 = new test(x) ; &lt;br /&gt;is executed, you'll notice that the two lines&lt;br /&gt; public object y=0; public object objid = nextid() ; &lt;br /&gt;are run before the second constructor&lt;br /&gt; test(test copy) &lt;br /&gt;is entered.&lt;br /&gt;The static function nextid() returns the value of the static field id and postincrements it. When you are learning objects and classes, the concept of static fields and functions is a bit alien because they apply to the type not an instance. A static class can exist without any instance fields or members.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; Example 6.&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;&lt;br /&gt;namespace ex1&lt;br /&gt;{&lt;br /&gt;    class ex1&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        static class test3 {&lt;br /&gt;&lt;br /&gt;            private static int x=8;&lt;br /&gt;            &lt;br /&gt;            public static int X {&lt;br /&gt;                get {&lt;br /&gt;                    return x;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                set {&lt;br /&gt;                    x=value;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            static test3()&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine("Static Constructor Called");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;            test3.X = 9;&lt;br /&gt;            Console.WriteLine("Value of test3.X ={0}",test3.X);&lt;br /&gt;            Console.ReadKey();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This has a static class test3. This can only have static members as no instances can be created. Members, and properties are accessed by the name of the class itself.&lt;br /&gt; test3.X = 9; &lt;br /&gt;Here X is a static property. Because test3 is a static class, there can be no instance members and everything must be declared static. If you put breakpoints on the static fieldx and the static constructor body you can see that those are executed sometime before the assignment takes place.&lt;br /&gt;&lt;br /&gt;Download Example 7.&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;&lt;br /&gt;namespace ex1&lt;br /&gt;{&lt;br /&gt;    class ex1&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        public static int GetValue(string Name)&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine("GetValue for {0}",Name);&lt;br /&gt;            return 99;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public class a {&lt;br /&gt;&lt;br /&gt;            &lt;br /&gt;            int aint = GetValue("aint");&lt;br /&gt;            static a () {&lt;br /&gt;                Console.WriteLine("Static Constructor a");&lt;br /&gt;            }&lt;br /&gt;            static int staint = GetValue("staint");&lt;br /&gt;            public a () {&lt;br /&gt;                Console.WriteLine("Constructor a");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public class b : a&lt;br /&gt;        {&lt;br /&gt;            static int stbint = GetValue("stbint");&lt;br /&gt;            int cint = GetValue("bint");&lt;br /&gt;&lt;br /&gt;            static b () {&lt;br /&gt;                Console.WriteLine("Static Constructor b");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public b () {&lt;br /&gt;                Console.WriteLine("Constructor b");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public class c : b&lt;br /&gt;        {&lt;br /&gt;            static int stcint = GetValue("stcint");&lt;br /&gt;            int cint = GetValue("cint");&lt;br /&gt;            static c()&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine("Static Constructor c");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public c(int v)&lt;br /&gt;            {&lt;br /&gt;                stcint = v;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public c() : this(1)&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine("Constructor c");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;            c obj = new c();&lt;br /&gt;            Console.ReadKey();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Example 7 shows three Classes a,b c such that a is the ancestor class and b is derived from a and c from b. All three classes have a default static constructor as well as a default instance constructor and two fields, one static, one instance.&lt;br /&gt;All fields have initializers on them which just return an int via a call to a static function that outputs the name of the field. This example shows the order in which fields are initialized and constructors (both static and instance) are called. The output is shown below. Fields are named to help reveal their nature- cint (int in class c) and stcint, a static int in class cetc.&lt;br /&gt; GetValue for stcint Static Constructor c GetValue for cint GetValue for stbint Static Constructor b GetValue for bint GetValue for staint Static Constructor a GetValue for aint Constructor a Constructor b Constructor c &lt;br /&gt;Forgetting about initializers for now, it's interesting to note that static constructors are called in the opposite order to instance constructors. All of this happens when this line is executed.&lt;br /&gt; c obj = new c(); &lt;br /&gt;Instance constructors are responsible for initializing their part of the instance and this is always in the order from base to the bottom derived class. The instance of b inherits from aso a is initialized then b then c. The compiler adds a hidden call to call the derived classes instance constructor. So c() calls b() which calls a().&lt;br /&gt;C# supports a constructor initializer list syntax not dissimilar to that of C++ except you can only initialize the base instance (perhaps adding in parameters) or the current instance class (through the use of the word this) Adding this code in below, and explicitly calling the base class does not affect the program as this is what the compiler does behind the scenes.&lt;br /&gt; public c() : base() {   Console.WriteLine("Constructor c") ; } &lt;br /&gt;You can even add in a call to another constructor, as in below. The single parameter instance constructor is called before the default constructor.&lt;br /&gt; public c(int v) {   stcint = v; } public c() : this(1) {   Console.WriteLine("Constructor c") ; } &lt;br /&gt;The use of base and this apply only to instances and not static classes. There is no instance in a static class.&lt;br /&gt;Static Constructors and Initializers So why were the static constructors and initializers and the instance initializers called in the order c, b ,a and not the same order as the instance constructors? Because that is the order that the classes are accessed. The first class created was c. What actually happens is this.&lt;br /&gt;1. Static Field Initializers are executed. These might be needed in the static constructor.&lt;br /&gt;2. Static Constructor is called.&lt;br /&gt;3. The instance initializer is called.&lt;br /&gt;4. The base class is accessed, repeating steps 1-3.&lt;br /&gt;Some Simple Rules to Remember&lt;br /&gt;• Field Initializers are called before Constructors.&lt;br /&gt;• Static Initializers and Constructors are called once before any instances are constructed.&lt;br /&gt;• Statics are called (in a class hierarchy) in the order that classes are used.&lt;br /&gt;• Instances are constructed in a hierarchy starting with the ancestor class.&lt;br /&gt;&lt;br /&gt;This example uses a struct, a class and a static field. Card games are popular on the web and example 8 demonstrates how to setup and use a pack of cards.&lt;br /&gt;Download Example 8&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;&lt;br /&gt;namespace ex1&lt;br /&gt;{&lt;br /&gt;    class ex1&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        enum CardValue {Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Jack,Queen,King,Ace};&lt;br /&gt;        enum CardSuit {Hearts, Clubs, Diamonds, Spades };&lt;br /&gt;        static char[] SuitChars= new char[4]{'H','C','D','S'};&lt;br /&gt;        static char[] SuitValues= new char[13]{'2','3','4','5','6','7','8','9','T','J','Q','K','A'};&lt;br /&gt;              &lt;br /&gt;        private struct CardType {&lt;br /&gt;            public static bool ShortCard=false;&lt;br /&gt;&lt;br /&gt;            public CardValue Value;&lt;br /&gt;            public CardSuit  Suit;&lt;br /&gt;&lt;br /&gt;            public override String ToString()&lt;br /&gt;            {&lt;br /&gt;                if (ShortCard)&lt;br /&gt;                    return SuitValues[(int)(Value)].ToString() +&lt;br /&gt;                        SuitChars[(int)Suit];&lt;br /&gt;                else&lt;br /&gt;                  return Value.ToString()+' '+Suit.ToString();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        class Deck&lt;br /&gt;        {&lt;br /&gt;            private Random r= new Random();&lt;br /&gt;            private int topcount;&lt;br /&gt;&lt;br /&gt;            private CardType [] cards = new CardType[52];&lt;br /&gt;&lt;br /&gt;            public  CardType this[int index] {&lt;br /&gt;                get { return cards[index]; }&lt;br /&gt;                set { cards[index]= value; }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            private int FindIndex(string ShortCardValue)&lt;br /&gt;            {&lt;br /&gt;                int result = -1;&lt;br /&gt;                for (int index = 0; index &lt; 52; index++)&lt;br /&gt;                {&lt;br /&gt;                    if (cards[index].ToString() == ShortCardValue)&lt;br /&gt;                    {&lt;br /&gt;                        result = index;&lt;br /&gt;                        break;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                return result;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public CardType this[string value]&lt;br /&gt;            {&lt;br /&gt;                get { return cards[FindIndex(value)]; }              &lt;br /&gt;            }     &lt;br /&gt;&lt;br /&gt;            public Deck()&lt;br /&gt;            {&lt;br /&gt;                int index=0;&lt;br /&gt; &lt;br /&gt;                foreach (CardSuit Suit in Enum.GetValues(typeof(CardSuit)))&lt;br /&gt;                {&lt;br /&gt;                    foreach (CardValue Value in Enum.GetValues(typeof(CardValue)))&lt;br /&gt;                    {&lt;br /&gt;                        cards[index].Value = Value;&lt;br /&gt;                        cards[index].Suit = Suit;&lt;br /&gt;                        index++;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;              ShuffleDeck();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public void ShuffleDeck() {&lt;br /&gt;                for (int index=0;index &lt;500;index++) {&lt;br /&gt;                    int first=r.Next(52);&lt;br /&gt;                    int second= r.Next(52);&lt;br /&gt;                    while (first == second) {&lt;br /&gt;                        second=r.Next(52);&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    CardType temp=cards[first];&lt;br /&gt;                    cards[first]=cards[second];&lt;br /&gt;                    cards[second]= temp;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public CardType DrawCard()&lt;br /&gt;            {&lt;br /&gt;                if (topcount == 0)&lt;br /&gt;                {&lt;br /&gt;                    ShuffleDeck();&lt;br /&gt;                    topcount = 52;&lt;br /&gt;                }&lt;br /&gt;                return cards[--topcount];&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;            CardType.ShortCard = true;&lt;br /&gt;            Deck MyCards = new Deck();&lt;br /&gt;            for (int i = 0; i &lt; 52; i++)&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine("Card {0} is {1}", i+1, MyCards[i]);&lt;br /&gt;            }&lt;br /&gt;            if (CardType.ShortCard)&lt;br /&gt;            {&lt;br /&gt;                CardType C = MyCards["2D"];&lt;br /&gt;            }&lt;br /&gt;            Console.ReadKey();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;I've chosen a struct for each playing card; there's little in the way of code apart from the overridden ToString() method. This uses a static bool ShortCard to output the cards in either long format E.g. King Spades or short, e.g. KS. This is a public static field in theCardType struct. Being static, it affects every card.&lt;br /&gt; CardType.ShortCard = false; // false = long format &lt;br /&gt;Enums are used for both the card values and suits. The Deck class holds an array of 52 cards and these are created by an initializer. A double loop then initializes the deck of cards. You can verify this by commenting out the ShuffleDeck() call and the cards will be printed in order. Two for loops would have done but this gave a chance to use the foreachconstruct. This iterates through all members of the CardSuit and CardValue enums.&lt;br /&gt; int index=0; foreach (CardSuit Suit in Enum.GetValues(typeof(CardSuit)))   {    foreach (CardValue Value in Enum.GetValues(typeof(CardValue)))       {          cards[index].Value = Value;          cards[index].Suit = Suit;          index++;       }   } &lt;br /&gt;The first foreach is the same as&lt;br /&gt; for (CardSuit Suit = CardSuit.Hearts;Suit &lt; CardSuit.Spades;Suit++) &lt;br /&gt;But the foreach is all round better- you're not going to pick the wrong value in the For loop as I did. Hearts was the first enum value, but the Intellisense feature of the IDE kept displayed the available values in alphabetical order.&lt;br /&gt;&lt;br /&gt;Continuing with the playing cards example, this demonstrates the use of an indexer. This is a way of accessing the Cards via an indexed property. Within the class Deck, cards is anarray but in the Main function, I access each card by using MyCards[ i ], yet MyCards is the actual instance of Deck. This property declaration is what does the trick.&lt;br /&gt; public CardType this[ int index] {          get { return cards[ index ]; }          set { cards[ index ]= value; }   } &lt;br /&gt;The property member is defined thus&lt;br /&gt; this[ int index ] &lt;br /&gt;and is called an indexer, in this case it's an int called index. Each class or struct can have multiple indexers as long as the signatures are unique. The signature is the bit inside square brackets eg [int index]. You might for example want to find the position of a card in the deck and there is a second indexer provided with this signature&lt;br /&gt; this [string value] &lt;br /&gt;This calls a function FindIndex() to search the array for a matching short card, e.g. "2D". This only works if the ShortCard bool is set to true. If it is, then a card can be retrieved like this:&lt;br /&gt; CardType C = MyCards["2D"]; &lt;br /&gt;Unlike other properties, this one always uses the keyword this (ie it refers to an instance of this class- this means it only works with instance objects and NOT static classes. Thesyntax is very similar to properties with get and set, but includes an indexed field. The general form is shown below, where the indexed field is called arr.&lt;br /&gt; public T this[int i] {     get { return arr[ i ]; }     set { arr[ i ] = value; } } &lt;br /&gt;Just like a property this includes get and set accessor methods to alter or access the private field array or structure. But you must use this for accessing the indexer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-83794389292514001?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/83794389292514001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/data-typesc-continued.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/83794389292514001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/83794389292514001'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/data-typesc-continued.html' title='Data Types(C# continued....)'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-1334376113263936466</id><published>2011-01-18T08:35:00.001-08:00</published><updated>2011-01-18T08:38:49.930-08:00</updated><title type='text'>Boxing n UnBoxing(C# continue....)</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Boxing and Un-boxing&lt;br /&gt;&lt;/span&gt;Boxing allows value types to be implicitly treated like objects. Suppose, we have an integer variable i as&lt;br /&gt;    int i = 5;&lt;br /&gt;when we write&lt;br /&gt;    i.ToString();&lt;br /&gt;The Compiler implicitly creates an instance of the Object class and boxes (stores) a copy of this int value (5) in the object. It then calls the ToString() method on the instance of the Object class which has boxed the copy of the int value. It is similar to writing&lt;br /&gt;    int i = 5;&lt;br /&gt;    Object obj = i;    // implicit boxing&lt;br /&gt;    obj.ToString();&lt;br /&gt;You can see in the above code that boxing is implicitly applied in C# and you don't have to write&lt;br /&gt;    Object obj = (Object) i;    // unnecessary explicit boxing&lt;br /&gt;On the other hand, un-boxing is explicit conversion from object type to value type. The following lines show how un-boxing is implemented in C#&lt;br /&gt;    int i = 5;&lt;br /&gt;    Object obj = i;        // implicit boxing&lt;br /&gt;    int j = (int) obj;    // explicit un-boxing&lt;br /&gt;Like down-casting, un-boxing can be un-safe and throw an InvalidCastException at runtime.&lt;br /&gt;&lt;br /&gt;My_openion:Although boxing and un-boxing look very similar to up-casting and down-casting, there are some points that differentiate the two:&lt;br /&gt;• Boxing and Un-boxing are the transformations between value type and object, while casting just transforms the apparent (reference) type of objects&lt;br /&gt;• Value types are stored in a stack and objects are stored in a heap. Boxing takes a copy of the value type from the stack to the heap while un-boxing takes the value type back to the stack. On the other hand, casting does not physically move or operate on the object. Casting merely changes the way objects are treated in a program by altering their reference type.&lt;br /&gt;Food for thought: Exercise&lt;br /&gt;1. How are inheritance &amp; polymorphism in 'C#' different from Java and C++?&lt;br /&gt;2. How can we make:&lt;br /&gt;• a variable so that its value can not be changed once assigned at declaration time?&lt;br /&gt;• a reference to an object so that it can not reference any other object, except for the one it is made to reference at declaration time?&lt;br /&gt;• a method so that it can not be overridden by any of its sub-classes?&lt;br /&gt;• a class that can not be inherited by any other class?&lt;br /&gt;3. Can we override the properties and apply polymorphism on these?&lt;br /&gt;4. We saw that constructors are called in the order from top to bottom (parent to child class) in inheritance hierarchy. In which order are the destructors called during inheritance?&lt;br /&gt;5. What are the advantages of using the protected access modifier in inheritance?&lt;br /&gt;6. How is type casting different from boxing/un-boxing?&lt;br /&gt;7. When I compile and run the following program:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;namespace CSharpSchool&lt;br /&gt;{&lt;br /&gt;    class Test&lt;br /&gt;    {&lt;br /&gt;        static void Main()&lt;br /&gt;        {&lt;br /&gt;            Parent theParent = new Child();&lt;br /&gt;            Console.WriteLine("i = {0}", theParent.i);&lt;br /&gt;            theParent.MyMethod();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    class Parent&lt;br /&gt;    {&lt;br /&gt;        public int i = 5;&lt;br /&gt;        public virtual void MyMethod()&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine("I am Parent's MyMethod()");&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    class Child : Parent&lt;br /&gt;    {&lt;br /&gt;        public int i = 7;&lt;br /&gt;        public override void MyMethod()&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine("I am Child's MyMethod()");&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The output is:&lt;br /&gt;i = 5&lt;br /&gt;I am Child's MyMethod() As we called both i and MyMethod() using the Parent type reference containing the Child type object, why is i of Parent and MyMethod() of Child called?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-1334376113263936466?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/1334376113263936466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/boxing-n-unboxingc-continue_18.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/1334376113263936466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/1334376113263936466'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/boxing-n-unboxingc-continue_18.html' title='Boxing n UnBoxing(C# continue....)'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-4731648368133414549</id><published>2011-01-18T08:29:00.000-08:00</published><updated>2011-01-18T08:30:16.018-08:00</updated><title type='text'>BASICS OF .NET FRAMEWORK</title><content type='html'>&lt;span style="font-weight:bold;"&gt;.NET FRAMEWORK&lt;br /&gt;&lt;/span&gt;The .Net Framework is a key Microsoft offering and it provides a Multilanguage environment that enables you to develop , deploy, and run Windows applications, Web applications as well as Web services.&lt;br /&gt;The .Net languages extends developers capabilities by introducing Structured Exception Handling, Multi Threaded Programming, Versioning, ability to quickly create and use Web Services etc. The following link gives you an overview of each important &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;components in the .Net Framework .&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The Microsoft .Net Framework is a platform that provides tools and technologies you need to build Networked Applications as well as Distributed Web Services and Web Applications. The .Net Framework provides the necessary compile time and run-time foundation to build and run any language that conforms to the Common Language Specification (CLS).The main two components of .Net Framework are Common Language Runtime (CLR) and .Net Framework Class Library (FCL).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Common Language Runtime (CLR) is the runtime environment of the .Net Framework , that executes and manages all running code like a Virtual Machine. The .Net Framework Class Library (FCL) is a huge collection of language-independent and type-safe reusable classes. The .Net Framework Class Libraries (FCL) are arranged into a logical grouping according to their functionality and usability is called Namespaces. In the following sections describes how to .Net Framework manages the code in compile time and run time .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CLR&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Common Language Runtime (CLR) is an Execution Environment . It works as a layer between Operating Systems and the applications written in .Net languages that conforms to the Common Language Specification (CLS). The main function of Common Language Runtime (CLR) is to convert the Managed Code into native code and then execute the Program. The Managed Code compiled only when it needed, that is it converts the appropriate instructions when each function is called . The Common Language Runtime (CLR) 's Just In Time (JIT) compilation converts Intermediate Language (MSIL) to native code on demand at application run time.&lt;br /&gt;During the execution of the program ,the Common Language Runtime (CLR) manages memory, Thread execution, Garbage Collection (GC) , Exception Handling, Common Type System (CTS), code safety verifications, and other system services. The CLR ( Common Language Runtime ) defines the Common Type System (CTS), which is a standard type system used by all .Net languages . That means all .NET programming languages uses the same representation for common Data Types , so Common Language Runtime (CLR) is a language-independent runtime environment . The Common Language Runtime (CLR) environment is also referred to as a managed environment, because during the execution of a program it also controls the interaction with the Operating System. In the coming section you can see what are the main functions of Common Language Runtime (CLR).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;FCL&lt;br /&gt;The .Net Framework class library (FCL) provides the core functionality of .Net Framework architecture . The .Net Framework Class Library (FCL) includes a huge collection of reusable classes , interfaces, and value types that expedite and optimize the development process and provide access to system functionality.&lt;br /&gt;The .Net Framework class library (FCL) organized in a hierarchical tree structure and it is divided into Namespaces. Namespaces is a logical grouping of types for the purpose of identification. Framework class library (FCL) provides the consistent base types that are used across all .NET enabled languages. The Classes are accessed by namespaces, which reside within Assemblies. The System Namespace is the root for types in the .NET Framework. The .Net Framework class library (FCL) classes are managed classes that provide access to System Services . The .Net Framework class library (FCL) classes are object oriented and easy to use in program developments. Moreover, third-party components can integrate with the classes in the .NET Framework.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CLS&lt;br /&gt;Common Language Specification (CLS) is a set of basic language features that .Net Languages needed to develop Applications and Services , which are compatible with the .Net Framework. When there is a situation to communicate Objects written in different .Net Complaint languages , those objects must expose the features that are common to all the languages . Common Language Specification (CLS) ensures complete interoperability among applications, regardless of the language used to create the application.&lt;br /&gt;Common Language Specification (CLS) defines a subset of Common Type System (CTS) . Common Type System (CTS) describes a set of types that can use different .Net languages have in common , which ensure that objects written in different languages can interact with each other. Most of the members defined by types in the .NET Framework Class Library (FCL) are Common Language Specification (CLS) compliant Types. Moreover Common Language Specification (CLS) standardized by ECMA .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CTS&lt;br /&gt;Common Type System (CTS) describes a set of types that can be used in different .Net languages in common . That is , the Common Type System (CTS) ensure that objects written in different .Net languages can interact with each other. For Communicating between programs written in any .NET complaint language, the types have to be compatible on the basic level .&lt;br /&gt;These types can be Value Types or Reference Types . The Value Types are passed by values and stored in the stack. The Reference Types are passed by references and stored in the heap. Common Type System (CTS) provides base set of Data Types which is responsible for cross language integration. The Common Language Runtime (CLR) can load and execute the source code written in any .Net language, only if the type is described in the Common Type System (CTS) .Most of the members defined by types in the .NET Framework Class Library (FCL) are Common Language Specification (CLS) compliant Types.&lt;br /&gt;&lt;br /&gt;MSIL&lt;br /&gt;MSIL stands for Microsoft Intermediate Language. We can call it as Intermediate Language (IL) or Common Intermediate Language (CIL). During the compile time , the compiler convert the source code into Microsoft Intermediate Language (MSIL) .Microsoft Intermediate Language (MSIL) is a CPU-independent set of instructions that can be efficiently converted to the native code. During the runtime the Common Language Runtime (CLR)'s Just In Time (JIT) compiler converts the Microsoft Intermediate Language (MSIL) code into native code to the Operating System.&lt;br /&gt;When a compiler produces Microsoft Intermediate Language (MSIL), it also produces Metadata. The Microsoft Intermediate Language (MSIL) and Metadata are contained in a portable executable (PE) file . Microsoft Intermediate Language (MSIL) includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations&lt;br /&gt;&lt;br /&gt;PE (PORTABLE EXECUTABLE FILE)&lt;br /&gt;The Portable Executable (PE) format is a file format for executables, object code, and DLLs, used in 32-bit and 64-bit versions of Windows operating systems.&lt;br /&gt;The PE file format was defined to provide the best way for the Windows Operating System to execute code and also to store the essential data which is needed to run a program. Portable Executable File Format is derived from the Microsoft Common Object File Format (COFF).&lt;br /&gt;JIT (JUST IN TIME )COMPILER&lt;br /&gt;The .Net languages , which is conforms to the Common Language Specification (CLS), uses its corresponding runtime to run the application on different Operating Systems . During the code execution time, the Managed Code compiled only when it is needed, that is it converts the appropriate instructions to the native code for execution just before when each function is called. This process is called Just In Time (JIT) compilation, also known as Dynamic Translation . With the help of Just In Time Compiler (JIT) the Common Language Runtime (CLR) doing these tasks.&lt;br /&gt;The Common Language Runtime (CLR) provides various Just In Time compilers (JIT) and each works on a different architecture depending on Operating System. That is why the same Microsoft Intermediate Language (MSIL) can be executed on different Operating Systems without rewrite the source code. Just In Time (JIT) compilation preserves memory and save time during application initialization. Just In Time (JIT) compilation is used to run at high speed, after an initial phase of slow interpretation. Just In Time Compiler (JIT) code generally offers far better performance than interpreters.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MANAGED CODE IN .NET FRAMEWORK&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Managed Code in Microsoft .Net Framework, is the code that has executed by the Common Language Runtime (CLR) environment. On the other hand Unmanaged Code is directly executed by the computer's CPU. Data types, error-handling mechanisms, creation and destruction rules, and design guidelines vary between managed and unmanaged object models.&lt;br /&gt;The benefits of Managed Code include programmers convenience and enhanced security . Managed code is designed to be more reliable and robust than unmanaged code , examples are Garbage Collection , Type Safety etc. The Managed Code running in a Common Language Runtime (CLR) cannot be accessed outside the runtime environment as well as cannot call directly from outside the runtime environment. This makes the programs more isolated and at the same time computers are more secure . Unmanaged Code can bypass the .NET Framework and make direct calls to the Operating System. Calling unmanaged code presents a major security risk.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;METADATA&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Metadata in .Net is binary information which describes the characteristics of a resource . This information include Description of the Assembly , Data Types and members with their declarations and implementations, references to other types and members , Security permissions etc. A module's metadata contains everything that needed to interact with another module.&lt;br /&gt;During the compile time Metadata created with Microsoft Intermediate Language (MSIL) and stored in a file called a Manifest . Both Metadata and Microsoft Intermediate Language (MSIL) together wrapped in a Portable Executable (PE) file. During the runtime of a program Just In Time (JIT) compiler of the Common Language Runtime (CLR) uses the Metadata and converts Microsoft Intermediate Language (MSIL) into native code. When code is executed, the runtime loads metadata into memory and references it to discover information about your code's classes, members, inheritance, and so on. Moreover Metadata eliminating the need for Interface Definition Language (IDL) files, header files, or any external method of component reference.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ASSEMBLY&lt;br /&gt;&lt;br /&gt;Microsoft .Net Assembly is a logical unit of code, it contains code that the Common Language Runtime (CLR) executes. Assembly is really a collection of types and resource information that are built to work together and form a logical unit of functionality. During the compile time Metadata is created, with Microsoft Intermediate Language (MSIL), and stored in a file called a Manifest . Both Metadata and Microsoft Intermediate Language (MSIL) together wrapped in a Portable Executable (PE) file. Manifest contains information about itself. This information is called Assembly Manifest, it contains information about the members, types, references and all the other data that the runtime needs for execution.&lt;br /&gt;Every Assembly you create contains one or more program files and a Manifest. There are two types program files : Process Assemblies (EXE) and Library Assemblies (DLL). Each Assembly can have only one entry point (that is, DllMain, WinMain, or Main). We can create two types of Assembly, private Assembly and shared Assembly . A private Assembly is used only by a single application, and usually it is stored in that application's install directory. A shared Assembly is one that can be referenced by more than one application. If multiple applications need to access an Assembly, we should add the Assembly to the Global Assembly Cache (GAC).&lt;br /&gt;&lt;br /&gt;GAC(GLOBAL ACCESS CACHE)&lt;br /&gt;Each computer on which the Common Language Runtime is installed has a machine-wide code cache called the 'Global Assembly Cache'. The Global Assembly Cache (GAC) enables you to share assemblies across numerous applications.&lt;br /&gt;The GAC is automatically installed with the .NET runtime. The global assembly cache is located in 'Windows/WinNT' directory and inherits the directory's access control list that administrators have used to protect the folder.&lt;br /&gt;The approach of having a specially controlled central repository addresses the shared library concept and helps to avoid pitfalls of other solutions that lead to drawbacks like DLL hell.&lt;br /&gt;The Global Assembly Cache Tool (Gacutil.exe), that allows you to view and manipulate the contents of the Global Assembly Cache.&lt;br /&gt;&lt;br /&gt;CONTENT OF AN ASSEMLY&lt;br /&gt;A .NET  assembly can consist of following elements:&lt;br /&gt;a) Assembly Manifest - The Metadata that describes the assembly and its contents&lt;br /&gt;b) Type Metadata - Defines all types, their properties and methods.&lt;br /&gt;c) MSIL - Microsoft intermediate language&lt;br /&gt;d) A set of Resources - All other resources like icons, images etc.&lt;br /&gt;Only the assembly manifest is required, but either types or resources are needed to give the assembly in any meaningful functionality.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PRIVATE AND SHARED ASSEMBLY&lt;br /&gt;&lt;br /&gt;A private assembly is an assembly that is available to particular application where they are kept, and a Shared Assembly is a public assembly that is shared by multiple applications. That means, a Private Assembly cannot be references outside the scope of the folder where they are kept and a Shared Assembly is one that can be referenced by more than one application.&lt;br /&gt;In order to share an assembly, the assembly must be explicitly built for this purpose by giving it a cryptographically strong name . By contrast, a private assembly name need only be unique within the application that uses it.&lt;br /&gt;The classes that ship with the .NET Framework are all built as shared assemblies.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NAMESPACES&lt;br /&gt;&lt;br /&gt;Namespaces are the way to organize .NET Framework Class Library into a logical grouping according to their functionality, usability as well as category they should belong to, or we can say Namespaces are logical grouping of types for the purpose of identification.&lt;br /&gt;The .NET Framework Class Library (FCL ) is a large collection of thousands of Classes. These Classes are organized in a hierarchical tree. The System Namespaces is the root for types in the .NET Framework. We can uniquely identify any Class in the .NET Framework Class Library (FCL ) by using the full Namespaces of the class .In .Net languages every program is created with a default Namespaces . Programmers can also create their own Namespaces in .Net languages.&lt;br /&gt;&lt;br /&gt;GARBAGE COLLECTION&lt;br /&gt;&lt;br /&gt;The .Net Framework provides a new mechanism for releasing unreferenced objects from the memory (that is we no longer needed that objects in the program) ,this process is called Garbage Collection (GC). When a program creates an Object, the Object takes up the memory. Later when the program has no more references to that Object, the Object's memory becomes unreachable, but it is not immediately freed. The Garbage Collection checks to see if there are any Objects in the heap that are no longer being used by the application. If such Objects exist, then the memory used by these Objects can be reclaimed. So these unreferenced Objects should be removed from memory , then the other new Objects you create can find a place in the Heap.&lt;br /&gt;The reclaimed Objects have to be Finalized later. Finalization allows a resource to clean up after itself when it is being collected. This releasing of unreferenced Objects is happening automatically in .Net languages by the Garbage Collector (GC). The programming languages like C++, programmers are responsible for allocating memory for Objects they created in the application and reclaiming the memory when that Object is no longer needed for the program. In .Net languages there is a facility that we can call Garbage Collector (GC) explicitly in the program by calling System.GC.Collect.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-4731648368133414549?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/4731648368133414549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/basics-of-net-framework.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/4731648368133414549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/4731648368133414549'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/basics-of-net-framework.html' title='BASICS OF .NET FRAMEWORK'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6071031058820607247.post-3605610604360522390</id><published>2011-01-18T08:15:00.000-08:00</published><updated>2011-01-18T08:25:47.514-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PLEASE COMMENT'/><title type='text'>C#- a breath_breaker</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Question: Explain the working of CLR.&lt;br /&gt;Answer: &lt;/span&gt;&lt;br /&gt;CLR is Common Language Runtime and it forms the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program.&lt;br /&gt;.NET has CLR Following are the responsibilities of CLR &lt;br /&gt; &lt;span style="font-weight:bold;"&gt;Garbage Collection&lt;/span&gt; :- CLR automatically manages memory thus eliminating memory leakes. When objects are not referred GC automatically releases those memory thus providing efficient memory management. &lt;br /&gt; &lt;span style="font-weight:bold;"&gt;Code Access Security&lt;/span&gt; :- CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file.CAS will take care that the code runs under the environment of machines security configuration.&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;Code Verification&lt;/span&gt; :- This ensures proper code execution and type safety while the code runs.It prevents the source code to perform illegal operation such as accessing invalid memory locations etc. &lt;br /&gt;&lt;span style="font-weight:bold;"&gt; IL( Intermediate language )&lt;/span&gt;-to-native translators and optimizer’s :- CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code. &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Question: What is the difference between interface &amp; abstract classes.Explain&lt;br /&gt;Answer:&lt;br /&gt;Difference Between Interface &amp; Abstract Class:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.&lt;br /&gt;&lt;br /&gt;An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn’t support multiple inheritance, interfaces are used to implement multiple inheritance.&lt;br /&gt;Both together&lt;br /&gt;&lt;br /&gt;When we create an interface, we are basically creating a set of methods without any implementation that must be overridden by the implemented classes. The advantage is that it provides a way for a class to be a part of two classes: one inheritance hierarchy and one from the interface.&lt;br /&gt;When we create an abstract class, we are creating a base class that might have one or more completed methods but at least one or more methods are left uncompleted and declared abstract. If all the methods of an abstract class are uncompleted then it is the same as an interface but with the restriction that it cannot make a class inherit from it. The purpose of an abstract class is to provide a base class definition for how a set of derived classes will work and then allow the programmers to fill the implementation in the derived classes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Question:&lt;br /&gt;Difference between CTS and CLS.&lt;br /&gt;&lt;br /&gt;Answer:&lt;/span&gt;&lt;br /&gt;The .NET Framework provides a runtime environment called the Common Language Runtime or CLR (similar to the Java Virtual Machine or JVM in Java), which handles the execution of code and provides useful services for the implementation of the program.&lt;br /&gt;&lt;br /&gt;Common Type System (CTS) describes how types are declared, used and managed in the runtime and facilitates cross-language integration, type safety, and high performance code execution.&lt;br /&gt;The Common Language Specification (CLS) is an agreement among language designers and class library designers to use a common subset of basic language features that all languages have to follow.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Question:&lt;br /&gt;What is JIT? What are types of JIT?&lt;br /&gt;Answer:&lt;br /&gt;&lt;/span&gt;In computing, just-in-time compilation (JIT), also known as dynamic translation, is a technique for improving the runtime performance of a computer program. JIT builds upon two earlier ideas in run-time environments: byte code compilation and dynamic compilation. It converts code at runtime prior to executing it natively, for example byte code into native machine code. The performance improvement over interpreters originates from caching the results of translating blocks of code, and not simply reevaluating each line or operand each time it is met (see Interpreted language). It also has advantages over statically compiling the code at development time, as it can recompile the code if this is found to be advantageous, and may be able to enforce security guarantees. Thus JIT can combine some of the advantages of interpretation and static compilation.&lt;br /&gt;&lt;br /&gt;Several modern runtime environments, such as Microsoft's .NET Framework and most implementations of Java and most recently Action script 3, rely on JIT compilation for high-speed code execution&lt;br /&gt;&lt;br /&gt;Types.... &lt;br /&gt;1.PREJITCompiler.&lt;br /&gt;2.ECONOJITCompiler.&lt;br /&gt;3. NORMAL JIT compiler.&lt;br /&gt;Question:&lt;br /&gt;Explain the Fundamental concept of OOPs.&lt;br /&gt;Answer:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;1.OBJECT:&lt;br /&gt;&lt;/span&gt;An object is an abstraction of a real world entity. It may &lt;br /&gt;represent a person,a placea number and icons or something &lt;br /&gt;else that can be modelled.Any data in an object occupy some &lt;br /&gt;space in memory and can communicate with eachother . &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;2.CLASSES:&lt;br /&gt;&lt;/span&gt;A class is a collection of objects having common &lt;br /&gt;features .It is a user defined datatypes which has data &lt;br /&gt;members as well functions that manupulate these datas.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;3.ABSTRACTION:&lt;br /&gt;&lt;/span&gt;It can be defined as the seperation of unnecessary &lt;br /&gt;details or explanation from system requirments so as to &lt;br /&gt;reduce the complaxities of understanding requirments.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;4.ENCAPTULATION:&lt;/span&gt;&lt;br /&gt;It is a mechanism that puts the data and function together. &lt;br /&gt;It is bthe result of hiding implimintation details of an &lt;br /&gt;object from its user .The object hides its data to de &lt;br /&gt;accessed  by only those functions which are packed in the &lt;br /&gt;class of that object.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;5.INHERITANCE:&lt;/span&gt;&lt;br /&gt;It is the relationship between two classes of object such &lt;br /&gt;that one of the classes ,the child takes all the relevent &lt;br /&gt;features of other class -the parent.&lt;br /&gt;Inheritance bring about  reusablity.&lt;br /&gt;6&lt;span style="font-weight:bold;"&gt;.POLYMORPHISM:&lt;/span&gt;&lt;br /&gt;polymorphism means having many forms that in a single &lt;br /&gt;entity can takes more than one form.Polymorphism is &lt;br /&gt;implemented through operator overloading and function &lt;br /&gt;overloading.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;7.DYNAMIC BINDING:&lt;/span&gt;&lt;br /&gt;Dynamic binding is the proces of resolving the function to &lt;br /&gt;be associated with yhe respective functions calls during &lt;br /&gt;their runtime rather than compile time.&lt;br /&gt;8.MESSAGE PASSING:&lt;br /&gt;Every data in an objest in oops that is capable of &lt;br /&gt;processing request known as message .All object can &lt;br /&gt;communicate with each other by sending message to each other&lt;br /&gt;............please Comment...........&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6071031058820607247-3605610604360522390?l=theawanish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://theawanish.blogspot.com/feeds/3605610604360522390/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://theawanish.blogspot.com/2011/01/c-breathbreaker.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/3605610604360522390'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6071031058820607247/posts/default/3605610604360522390'/><link rel='alternate' type='text/html' href='http://theawanish.blogspot.com/2011/01/c-breathbreaker.html' title='C#- a breath_breaker'/><author><name>awanish</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_BI96u8xWIE0/SZwpe-WwTvI/AAAAAAAAAAs/Jxwevm2u8Vo/S220/P0902161312211.jpg'/></author><thr:total>0</thr:total></entry></feed>
