cplusplus:c_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
cplusplus:c_examples [2017/05/01 00:06] – mithat | cplusplus:c_examples [2020/05/03 23:07] – [C Examples] mithat | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== C Examples ====== | ====== C Examples ====== | ||
adapted from \\ | adapted from \\ | ||
- | **Differences Between C and C++** \\ | + | **Differences Between C and C++** by Robert Niemann (Century College) \\ |
- | by Robert Niemann (Century College) \\ | + | |
11/22/2015 | 11/22/2015 | ||
Line 8: | Line 7: | ||
* [[http:// | * [[http:// | ||
- | * [[http:// | + | * [[http:// |
+ | |||
+ | |||
+ | <file c example00.c> | ||
+ | /* Basic printf use. */ | ||
+ | #include < | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | int numSpoons = 5; | ||
+ | |||
+ | printf( "I have %d spoons.", | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
<file c example01.c> | <file c example01.c> | ||
+ | /* Basic scanf use. */ | ||
#include < | #include < | ||
Line 26: | Line 41: | ||
<file c example02.c> | <file c example02.c> | ||
+ | /* Common I/O format specifiers. */ | ||
#include < | #include < | ||
Line 42: | Line 58: | ||
<file c example03.c> | <file c example03.c> | ||
+ | /* More I/O format specifiers. */ | ||
#include < | #include < | ||
Line 71: | Line 88: | ||
int x; | int x; | ||
- | ptr_file =fopen(" | + | ptr_file = fopen(" |
if (!ptr_file) | if (!ptr_file) | ||
Line 96: | Line 113: | ||
char buf[1000]; | char buf[1000]; | ||
- | ptr_file =fopen(" | + | ptr_file = fopen(" |
if (!ptr_file) | if (!ptr_file) | ||
{ | { |
cplusplus/c_examples.txt · Last modified: 2020/12/07 02:40 by mithat