Presentation is loading. Please wait.

Presentation is loading. Please wait.

C vs. C++ I/O Declaration Placement Strings Minor syntax differences (ala enum)

Similar presentations


Presentation on theme: "C vs. C++ I/O Declaration Placement Strings Minor syntax differences (ala enum)"— Presentation transcript:

1 C vs. C++ I/O Declaration Placement Strings Minor syntax differences (ala enum)

2 C vs. C++ Standard I/O I/O – C uses printf and scanf – C++ uses cin, cout

3 C vs. C++ Declaration Placement Declaration Placement – C++ allows a declaration to be placed anywhere – C only allows declarations BEFORE any executable statements within a “block” – A block starts with a { and ends with a }

4 C vs. C++ Strings Strings – C++ provides powerful string class, and thus MOST space required for strings not explicitly stated by programmer – C requires explicit declaration of space (either static or dynamic) for string space (as an array of char values) – C uses a library of string functions, including strcpy, strcat, strlen, strcmp, …

5 CSP Machine “Gotchas” Note: This slide is an anachronism. It no longer applies as we don’t use the CSP machines anymore. I include it to show how good you have it now! Declaration placement in C programs Quoted Strings wrapped around lines, Printf(“This will be a string that is wrapped around a single line. It is not allowable in C, BUT the csp machine gcc (very old) doesn’t seem to recognize that\n”);


Download ppt "C vs. C++ I/O Declaration Placement Strings Minor syntax differences (ala enum)"

Similar presentations


Ads by Google