!"#$% &'($) *+!$ 0!'" 0+'&"$.&0-2$ 10.+3&2),&/3+, %&&/3+, C,-"!.&/+"*0.&('1 :2 %*10% *%7)/ 30'&. 0% /4%./
|
|
- Christopher Sparks
- 5 years ago
- Views:
Transcription
1 0!'" 0+'&"$ &0-2$ 10 +3&2),&/3+, #include <stdioh> int main() int i, sum, value; sum = 0; printf("enter ten numbers:\n"); for( i = 0; i < 10; i++ ) scanf("%d", &value); sum = sum + value; printf("their sum is %d\n", sum);!"#$% &'($) *+!$ C,-"! &/+"*0 &('1 :2 %*10% return 0;?C,-"!!"#$,&/3+, )" %/!$% +%$ :%)*"% )'!&"/ +&%,!"#$!%!"& #'()* '+#&,% -!(%/ 0& 11'*), #!)1$ #/$1',#'$!*$ 23!$,2!!4%,('# 3!3!5!"&' #'7 #41)1* 8&0$ 0$+!)!"& '8*'& 2007 *!*$ #41)1* 2'%%-2*!0$ /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 2 %&&/3+, *%7)/ 30'& 0% /4%/ /%/ 0% 2!!,*!,*$ (keywords) 3'#')% -!0) - (identifiers) -!/9) - #define! & -!!0'*)!1 -!&'*( 3#85/ - -!!1!1* &8!)!1'!4 2'#+!9 8*&)/ 0% 40 8*&) '#+!9 C 3%* 3!,+'3 /,*) (comments) 3'#&/ - (functions) 3'!"(,' - #include! & -!!,'"!7 8'(!&4( 300+/ - (-!#1) 10 -'+!1) -8'(/ #'&!%/) 3!,+'30 -!#'!%' 3'1'3 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 4 40( &8!) 8*&0 8"!+ 8*&)0 /#!85) *%7) 3!,+'3 C 3%* 8'*!&/ 3$ #!85, /9 1#'(* /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 3
2 (white spaces) &/!) &#++0 C,-" )" 4&&/!% &/!* :-!$*/ -!#*8/) #3'! '$ 87$ 0% 6"# (white space) 2*0 7''# 7''# - (tab) 7''!0 - /#&/ - /#'% #*&) - 8*0) 3'8')" (tokens) -!0) 2!* /8#/0 -!%)%) -!,*0 -!7''# -/) -0&3/0 4'% 23!,,3$9 (indentation) "/79/" &"*0 3,) 0& tab/-!7''#* %)3%/0 5'/, 38#, /#'%* ('1 0+ -'%#0 5'/, C 3!,+3 3*+#') -/)% (characters -!''3) -!,)!1/ 61'$, 7''#!,)!1,3'#1,3'0'85 3'!3'$,3',4( 3'!,!40 3'!3'$ :0!+) (70 8')& ABC /$#) (8'&',=,>,<,],[,),(-,+,/,* &,%) -!1', -!,)!1 0",/ 61'$/) -!''3 0% /#81 /,!/ C 3!,+3 '9 -!''3 3#81 3('07 $'/ /!"0!)'(/ :!0/3* 2'%$#/ *0%/ (tokens) "-!0!)"-0, -!&'*(,(-!,3%)0) -!/9),3'#')% -!0!) :C 3%* -!0!)/!5'1 -!7''#)/!"& -!8#, '0$',('1!!,)!1,-!#'4#'$,39'#7)!&'*( -/!,!*% /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 6 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 5 keywords -,+0+$" &)&$ (white spaces) &/!) &# ' C 3'!,+3* /&'*( 3'&)%) 2/0 %!% -!0!) 2,!/ 3'#')% -!0!) %87) 23'&)%) 3$ #!85/0 #'1$ (?',!$# #*+ 2/) '0!$) :3'#')%/ -!0!)/ 32 3)!%# auto do goto signed unsigned break double if sizeof void case else int static volatile char enum long struct while const extern register switch continue float return typedef default for short union 3'#')% -!0) #1) '1', C99-* #!85/0 $0 ;0)')% 3'1', -!0!) 3')!!( 3'#')%/ -!0!)/ 8*0) /)'8+' main, printf, scanf 2'5+,%87) 23'&)%) 3$ /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 8 3'8'(+ -!,*0 -!7''#* (# 3%)3%) whitespace 3',+3/ 3% -!,)!1/ #$% 0+) 3)0&3)' whitespace-* -5' C-* -5 8'*&3% 3!,+'3 *'3+0 #%$ :(0!&0 #3$/ :'3)) 3','#3! /)+ /,/ Some things which are difficult in other languages are made much easier in Whitespace For example, literate programming is simply a matter of writing your helpful comments in between program instructions It's also easy to encrypt your programs Simply write a misleading comment! Whitespace is a particularly useful language for spies Imagine you have a top secret program that you don't want anyone to see What do you do? Simply print it out and delete the file, ready to type in at a later date Nobody will know that your blank piece of paper is actually vital computer code! /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 7
3 constants - &'+!6 &%5$+ &/,"$ int main() int num_of_students; double failure_rate; char success_sign, failure_sign; num_of_students = 600; success_sign = + ; failure_sign = F ; if (failure_rate > 025) 0$)%)% 3'8'(*, -!)0% -!&'*( -!&!')!&'*(' -!!%)) -!&'*( -!''3!" //9) 1002 :0/)* 3',3%/0!'%& '+#&%,2'#+!9* $3 :(variable) /,3%) 3!,+3/ 30'& #'*& -!"'7,/ -!,'3, -!#)%, '*',3!,+3/ 3*'3+ 2'#+!9* x 5 $3/ 2+'3 " -% 330"!8+ 8&', :(identifier) //9) /!"(,'0 '$ 1'!40,/,3%)0 3'#1,3'!3'$) *+#') 3'!/0 0'+! //9) - /#1* 0!73/0 0'+! ',!$ :$ '_' '3/' $0 0*$) 3'&)%)!0&* -!/9) #'7*0 ;0)') - (!8!) -!0*#'1) grade_of_semester_a = test_grade * gsa = tg * hg * factor; hw_grade * factor; /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 10 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 9,5+0#$+ +, &'+!6 &&"$$+ &$)" - &&0-2$ &'+!6 39'#7) &'*( 3$#(, " " :'3* /,'3,/ -!''3 3#81 -/0 %!% 3'&)%)/ 3$ -!''3/' -!0!)/ -!8*$),39'#7)/ :'3* : 0%)0 39'#7)0 ;'7) "a = b + c"; printf("return 1"); #'*!7 30'& 3&"*3) $0-3!,+3/ -'!10 -#'5 $0-39'#7) &'*( $!/ a /0!)/ '3 &'*( $!/ a!"#$! :(3!(07 /)!%#) -!87'!) '3!&'*( '\n' /#'% #*&) - '\"' -!!%#5 - :-!)0% -!&'*(0 3'$)5' x1B7 - : -!!%)) -!&'*(0 3'$)5' e+9-2e7 2e-7-2 &'*(/) /,'% 2'$* 2'#+!9* 5"'!) 20 &'*(/ /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 12 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 11
4 %&&/3+, #define &"' &&)+!$&2 &'+!6,0(7% /%/ 0% 2!!,*!,*$ (keywords) 3'#')% -!0) - (identifiers) -!/9) - #define! & -!!0'*)!1 -!&'*( 3#85/ - -!!1!1* &8!)!1'!4 C 3%* 3!,+'3 /,*) (comments) 3'#&/ - (functions) 3'!"(,' - #include! & -!!,'"!7 8'(!&4( 300+/ - (-!#1) 10 -'+!1) -8'(/ #'&!%/) 3!,+'30 -!#'!%' 3'1'3 0+ '07'! preprocessing-/ *0%*% :+0 3)#'5 /$*/ /$#'// !''3/ 3#81* MAX_SIZE 0% -!&')/ #define MAX_SIZE !07') -,!$ 39'#7) :'3* MAX_SIZE 0% -!&') 2'#+!9 '#'*& /"(') $0' /,3%) ',,!$ MAX_SIZE :*0 ')!% : '9 /#85/* %')!%0 3'*!1 3!,+3 :'/0,88'*!',!% 3'&")$*,3#%$) 0",/ &'*(/ 3#85/ - -!,'3, * 304)/ 3!,+30 -!,'3, * 304)/ 0% 3'#9'7 3'80(/ 3+1'7' 3!,+3/ 3'$!#(0 3)#'3 PI &'*( 3#85/ -!""#$% &'(% )*!+)*", #define PI ::'#$ #1) scanf #define EOF -1 :31', /)5'8 - /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 14 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 13 &$)"% &2+-&8% C,-"! &'+!6+ &/,"$ &2+-&8 int ',!/!1!1*/ 1'!4/ 3#7$ 2)'1) -$ $0$,int 1'!4) ',!/ -0% &'*( 0+ 5'"!!0 -!"(')/ -!3*/ #1) 3$ &*'( ',!$ ANSI-C 0% 4#)/ -!3* :#8* -!"('),-'!+ 3'"',/ 3'+#&)* int 1'!4) :#& : 5"!!0 23!,% -!)0%/ -!+#&/ -'73 3$ &*'( int 0% '08'5-2 15,,-1,0,1, ,,-1,0,1, :(-!4!* 16) -!3* 2 - :(-!4!* 32) -!3* = 32768, 2 31 = int num, sum; double weight = 00; char digit = '4'; -!,'% -!1'!4 -!,3%)0-5,-!&'*(0 /)'8* %')!% -/* /%&,%!,0 -!,3%) #!85/0 %! :#0!!)'(0 /$#'/ /,!/ /#85// -!$3)/ 08'5* 2'#+!9* $3 3'"(/0-2'3,/ -%* '0 $'#(0-2'3,/ 1'!4/!0 ',+'3 3$ %#0-0'73!$ -5 6!1'/0 23!, - 8"!+,'#'*& /"(')% 2'#+!9/ $3 08'5 3$ &*'( /,3%)/ 1'!4 23!, 23'$ 3'0'&/ 3$' '* /#')%/ 3!#$,!*/ /#81/ 3$ -!%#) '!0& &"*0 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 16 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 15
5 &++, 7+1&& 9"$% - &$)"% &2+-&8% -0% 1'!4) -,!/ ' n' ' 0' ' a' ' A' 2'5+ '3!&'*( 2/!,!* /"',/ -0% :#& ' '+!!%)/ 3'&'8! 3'$0*4 3')!!( :/!-0&,ASCII 30*4 $!/ \0 0 1 A B a b DEL 3$ #')%0 3,)-0& (!1),88'* 3!* '08'5%,char 1'!4) /,3%) ASCII 30*4* -!&!')/ -!+#&/ 0+ char letter = 'd'; char letter = 100; :3'0'(% 3'$*/ 3')%// 3,!7*) char, short, long :-!1', -!)0% -!1'!4 :8!)3 -!!(3) (1'3 1'!4 0+% -!3*/ #1)) -!085/ 1 = char! short! int! long -!1'!4/ 3')%!,0 unsigned /#')%/ /0!)/ 31'/!8! 0& -'73 3$ 0!+,' -!!0!0%/ -!#1)/ 5'"!! 0& #3'', -!)0%/ 5'"!!0 -!,3!,/ -!*'!7/ -!#1)/ :/)5' ,,-1,0,1, :(-!3* 4 7!,,) int /,3%) - 0,1, :unsigned int /,3%) - /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 18 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 17 %"#$% :ASCII-%,)!8 %"#$% :ASCII-%,)!8 Macintosh-9 $ gcc -lc ascii_tablec -o ascii_tableout Macintosh-9 $ /ascii_tableout '!' = 33 '"' = 34 '#' = 35 '$' = 36 '%' = 37 '&' = 38 ''' = 39 '(' = 40 Macintosh-9 $ #include <stdioh> int main() char val; int i; for (i = 33; i < 41; i++) val = i; printf("\ %c\ = %d\n",val,val); return 0; RUN See the complete table in /$"#/ 1 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 20 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 19
6 %-1% %(+6/%,8&"! 7+1&& &&"$$% &2+-&8% :-!!#$,!* -!#*%+ *%7)* -!5"'!) /" '(,* -!#1)/ sign exponent mantissa (!'8)* -!5"'!) 2 0% /(97-3,)% -!#*%' -!)0% -!#1) - *#'()* -!5"'!) -!#7$ -!#*% '73/ 3$ /0!85) /#3!/,3'!*!1 #3'!!8!-0& 5"'!) 1'!4 #%$+ (7''4/ '$/' ('!8/ 085 /$"'3+') exponent-/ '$/' mantissa-/ 0% double ',!/!1!1*/ 1'!4/ 3#7$ 2)'1) -$ $0$,double 1'!4) -,!/ -!!%)) -!&'*( :-!)!!() -!085/ float, long double :-!1', -!%)) -!1'!4 float! double! long double -!3* 4 $'/ float #'*&' -!3* 8 $'/ double #'*& ;', 08'5 (floating point) /"/ /8'(,/ 34!%* -!5"'!) -!!%))/ -!#1)/ *'#! 0& *#'() ',!/ *%7)* -!!%)) -!#1) 5'"!! ('!8/ 3)# 3$ 2+' -!5"'!)/ -!#1)/ -'73 3$ &*(! 1'!4/ 08'5 *'#!(/ 0% /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 22 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 21 C,-"!,&/3+, %/!$ %&&/3+, /* * The traditional first program in honor of * Dennis Ritchie who invented C at Bell Labs * in 1972 */ ;*'( 300+/ #include<stdioh> int main() main "#$%&'(" printf("hello World!\n"); return 0; #97') :#&!"& :1)0 /18/ /!"(,'0 /$!#( /#&/ /%/ 0% 2!!,*!,*$ (keywords) 3'#')% -!0) - (identifiers) -!/9) - #define! & -!!0'*)!1 -!&'*( 3#85/ - -!!1!1* &8!)!1'!4 C 3%* 3!,+'3 /,*) (comments) 3'#&/ - (functions) 3'!"(,' - #include! & -!!,'"!7 8'(!&4( 300+/ - (-!#1) 10 -'+!1) -8'(/ #'&!%/) 3!,+'30 -!#'!%' 3'1'3 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 24 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 23
7 ,+0'% %&16/+- &08$0- %2&/3,+&16/+- 8)-\8)6 &30' *1+$ :/0'+! #%$ *'%!7 38!7! (function) /!"(,' (-!#4)#) -!+#& 0*(0 - -!'1) *'%!7 *%70 - (-!1', -!#*8') 40/40( &"*0 - :#& #!97/0 -,procedure, subroutine -!7,')* -5 -!%)3%) 3'#7$ 3'%* :%! /!"(,' 0+0 /#97/ :#& 3$' 30*() $!/% -!#4)#/,/)% 3$ 3#$3)/ /#/"/ - /#/"// 3$,#3!/ 2!*,/0!+) /#85/ /!"(,'/ 6'5 3#85/ - /!0& /#/"// $'*0 3*!!7 /!"(,'* %')!%/!,0 1#'(/ :%)/* 3'!"(,' 3'8'$ *!7#, ',$ /* */ :'3* (comment) /#&/ */ 6'#"* 3)!!31)' /* 6'#"* /0!73) /#&// - 3'#'% #1)!, 0& %/0 /0'+! /#&/ - :(nested) 3',,'() 3'#&/0 3'#%$ 2!$ /* This is /* a very long /* comment */ /* 2nd comment*/ :/#'%/ 6'10 8& //!#7$ $*% 41(4-5 $!/ /#&/ C99 2(3!0 // This is a comment a = b + c; // This is another comment /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 26 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 25 #include &"',))3%+,0,+3 &1!6 %$7+(,+&16/+- 0!+) #%$ " h" 3)'!1 0&* ;*'( :(header file) 3#3'+ ;*'( -!!,'"!7 -!)"& 0& 3'#/"/ #97') 1'!4 -% float power(float x, int n); :8*0* /#/"/ #include <stdioh>//!"#-!"$ %&'($)&# "* %&+,(, "'- #include <mathh> // %&'!% %&'($)&# "* %&+,(, "'- 3#3'+ ;*'( 0!0+/0 /!7,/ ',$% 2''!+ stdioh 0% /00+/ /,%!,',!$#% HelloWorld 3!,+'3* $0 8'(/ '9 /00+/ $00 -% 3#/"')/ printf /!"(,'* -!%)3%) /!"(,'/ 0& /#/"/ 3'$#0 /") #0!!)'(/!+ /!"0!)'( #*'& /!/ /* %')!%/!,0 float power(float x, int n) float p; int i; p = 10; for (i = 0; i < n; i++) p = p*x; return p; -!#4)#!,% :/#85/ /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 28 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 27
8 scanf &"' 3# 8)- :stdioh :!+6% printf &"' 3# 8)6 :stdioh :!+6%,(0'5#3* 4'#!) /#(* 39'#7) $'/ 2'%$#/ 4,)'5#$/ :-!#4)# 4)#'/!0 $'#(0 %! -3'$ -!,3%)/ -!$* /!#7$' /#(*/ 39'#7)* #'3* $*/ %-/ 8'(0 -!$3) 4,)'5#$ 0+ - (:%)/* &'8) 2!*,) /,3%)/ -%!,0 & 6!1'/0 %! - 0% /#()* -1 '$,/70"/* '$#(,% -!,'3,/ #1) :/#97/ :#& 2'0%+ 7'+%0 $0 &-" )* int i; double x; float y; scanf("%d%lf%f", &i, &x, &y); :/)5'8,(0'5#3* 4'#!) /#(* 39'#7) $'/ 2'%$#/ 4,)'5#$/ :-!#4)# 4)#'/!0 *'3+0 %! -3'$ -!+#&/ -!$* /!#7$' /#(*/ 39'#7)* #'3* $*/ % -/ 8'(0 -!$3) 4,)'5#$ 0+ - $'/% ')+ 18'!% (% $00) 0!5# 41(4 0!+/0-5 /0'+! /#(*/ 39'#7) - 2'0%!+ 3&*!0!0% #1) '$,'*3+,% -!''3/ #1) :/#97/ :#& printf("just printing text\n"); int i = 5; printf("the average of (%d,%d,%d) is %f", 1, i, 5, (1+i+5)/30); :3'$)5'8 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 30 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 29 %&&/3+, main %&16/+-% /%/ 0% 2!!,*!,*$ (keywords) 3'#')% -!0) - (identifiers) -!/9) - #define! & -!!0'*)!1 -!&'*( 3#85/ - -!!1!1* &8!)!1'!4 C 3%* 3!,+'3 /,*) (comments) 3'#&/ - (functions) 3'!"(,' - #include! & -!!,'"!7 8'(!&4( 300+/ - (-!#1) 10 -'+!1) -8'(/ #'&!%/) 3!,+'30 -!#'!%' 3'1'3 &'"!*/ main $'/ /)% #%$ /!"(,' 0!+/0 3*!!7 C-* 3!,+'3 '9 /!"(,'* 07! 3!,+'3/ 0%!%&)/ int main() -!#4)# 30*() /,!$ main!+ 7!,, /9 *0%* #97') /9 :#& "3!,+'3/ -'!1 8'(" $'/ /,)) #97')/ :#&/ /0&// 3+#&)0 /70"/* -'!1 :0 -!/%0+ /!!&* :0-) /,'% - /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 32 /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 31
9 &0+-&" &0-2$ +3&2),&/3+, 0!'" 0+'&"$ &0-2$ 10 +3&2),&/3+, #include <stdioh> int main() int i, sum = 0, value, num_of_values; RUN #include <stdioh> int main() int i, sum, value; printf("please enter number of values\n"); scanf("%d", &num_of_values); for (i = 0; i < num_of_values; i++) printf("enter the next integer: "); scanf("%d", &value); sum = sum + value; printf("the sum of the %d numbers is %d\n", num_of_values, sum); return 0; sum = 0; for( i = 0; i < 10; i++ ) scanf("%d", &value); sum = sum + value; printf("%d \n", sum); return 0; /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 34 /$"#/ 1 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 33,+-2+,% )' &0!2% %10% &0-2$ +3&2),&/3+, %)3%)/ -& 7!%-'8 300'+/ 3!,+3 /,!/ 3!*!4($#4,!$ 3!,+3 40' 40( 3'8'( :#8 -!4%)* '0 #!*1/0 "%)3%)0 3!3'8!8!" 3'!/0 3!,+3/ 0& '0 23!,% 40/ '/)' &"*0 '!0& /) -!#'#* /"!#/ 2)9* %)3%)/!8!-0& &*(, -!)+'1)/ -!+#&/ #1) RUN - /1,, '$'*?#1) -'()* 3'$ 1!,+! %)3%)/ -$' -!+#& 3'$")!/ 0%* 3!,+3/ 3"!# %'*!% 3&,') 40(/ 3'!('7 3(!8* - 40(* -!!'5% Macintosh-9 $ gcc -lc better_sumc -o better_sumout Macintosh-9 $ /better_sumout Please enter number of values 4 Enter the next integer: 2 Enter the next integer: 3 Enter the next integer: 4 Enter the next integer: 5 The sum of the 4 numbers is 14 Macintosh-9 $ /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 36 /$"#/ 1 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 35
10 8)6,6&(! &0-2$ 10 +3&2),&/3+, %10% - &+7" 8)6 printf("please enter number of values\n"); if (scanf("%d", &numbers_to_read) < 1) printf("failed reading the number of values\n"); return 1; 31', /(!8* /9!$ /)?3'%&0!$8+ ' 1) 1!,+, -$ /#(!?-0% $0 for( i = 0; i < numbers_to_read; i++ ) printf("enter the next integer: "); if (scanf("%d", &value) < 1) printf("failed reading value %d\n", i + 1); return 1; sum = sum + value; Macintosh-9 $ /better_sumout Please enter number of values 4 Enter the next integer: a Enter the next integer: Enter the next integer: Enter the next integer: The sum of the 4 numbers is 0 Macintosh-9 $ /$"#/ 2 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 38 /$"#/ 1 3'#')% 3'!'+9/ 0+ *%7)/!&8)0 $'*) 37
Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14
C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition
More informationPresented By : Gaurav Juneja
Presented By : Gaurav Juneja Introduction C is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs of UNIX are written
More informationData Types and Variables in C language
Data Types and Variables in C language Basic structure of C programming To write a C program, we first create functions and then put them together. A C program may contain one or more sections. They are
More informationProgramming in C++ 4. The lexical basis of C++
Programming in C++ 4. The lexical basis of C++! Characters and tokens! Permissible characters! Comments & white spaces! Identifiers! Keywords! Constants! Operators! Summary 1 Characters and tokens A C++
More informationC Fundamentals & Formatted Input/Output. adopted from KNK C Programming : A Modern Approach
C Fundamentals & Formatted Input/Output adopted from KNK C Programming : A Modern Approach C Fundamentals 2 Program: Printing a Pun The file name doesn t matter, but the.c extension is often required.
More informationVariables in C. Variables in C. What Are Variables in C? CMSC 104, Fall 2012 John Y. Park
Variables in C CMSC 104, Fall 2012 John Y. Park 1 Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement 2 What Are Variables in C? Variables in C have the
More informationC: How to Program. Week /Mar/05
1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers
More informationC Language, Token, Keywords, Constant, variable
C Language, Token, Keywords, Constant, variable A language written by Brian Kernighan and Dennis Ritchie. This was to be the language that UNIX was written in to become the first "portable" language. C
More informationChapter 1 & 2 Introduction to C Language
1 Chapter 1 & 2 Introduction to C Language Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 1 & 2 - Introduction to C Language 2 Outline 1.1 The History
More information6.096 Introduction to C++ January (IAP) 2009
MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture
More informationLaboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information
Laboratory 2: Programming Basics and Variables Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information 3. Comment: a. name your program with extension.c b. use o option to specify
More informationChapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic
More informationVariables in C. CMSC 104, Spring 2014 Christopher S. Marron. (thanks to John Park for slides) Tuesday, February 18, 14
Variables in C CMSC 104, Spring 2014 Christopher S. Marron (thanks to John Park for slides) 1 Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement 2 What
More informationRecap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam
Multimedia Programming 2004 Lecture 2 Erwin M. Bakker Joachim Rijsdam Recap Learning C++ by example No groups: everybody should experience developing and programming in C++! Assignments will determine
More informationPROGRAMMAZIONE I A.A. 2018/2019
PROGRAMMAZIONE I A.A. 2018/2019 COMMENTS COMMENTS There are two ways to insert a comment in C: üblock comments begin with /* and end with */, and üline comments begin with // and end with the next new
More informationIntroduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan
Introduction to C Programming Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Printing texts Adding 2 integers Comparing 2 integers C.E.,
More informationANSI C Programming Simple Programs
ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double
More informationBasic Elements of C. Staff Incharge: S.Sasirekha
Basic Elements of C Staff Incharge: S.Sasirekha Basic Elements of C Character Set Identifiers & Keywords Constants Variables Data Types Declaration Expressions & Statements C Character Set Letters Uppercase
More informationSyntax and Variables
Syntax and Variables What the Compiler needs to understand your program, and managing data 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line
More informationET156 Introduction to C Programming
ET156 Introduction to C Programming Unit 1 INTRODUCTION TO C PROGRAMMING: THE C COMPILER, VARIABLES, MEMORY, INPUT, AND OUTPUT Instructor : Stan Kong Email : skong@itt tech.edutech.edu Figure 1.3 Components
More informationProgramming and Data Structures
Programming and Data Structures Teacher: Sudeshna Sarkar sudeshna@cse.iitkgp.ernet.in Department of Computer Science and Engineering Indian Institute of Technology Kharagpur #include int main()
More informationCOP 3275: Chapter 02. Jonathan C.L. Liu, Ph.D. CISE Department University of Florida, USA
COP 3275: Chapter 02 Jonathan C.L. Liu, Ph.D. CISE Department University of Florida, USA Program: Printing a Pun #include int main(void) { printf("to C, or not to C: that is the question.\n");
More informationC/Java Syntax. January 13, Slides by Mark Hancock (adapted from notes by Craig Schock)
C/Java Syntax 1 Lecture 02 Summary Keywords Variable Declarations Data Types Operators Statements if, switch, while, do-while, for Functions 2 By the end of this lecture, you will be able to identify the
More informationC/Java Syntax. Lecture 02 Summary. Keywords Variable Declarations Data Types Operators Statements. Functions. if, switch, while, do-while, for
C/Java Syntax 1 Lecture 02 Summary Keywords Variable Declarations Data Types Operators Statements if, switch, while, do-while, for Functions 2 1 By the end of this lecture, you will be able to identify
More informationfrom Appendix B: Some C Essentials
from Appendix B: Some C Essentials tw rev. 22.9.16 If you use or reference these slides or the associated textbook, please cite the original authors work as follows: Toulson, R. & Wilmshurst, T. (2016).
More informationXSEDE Scholars Program Introduction to C Programming. John Lockman III June 7 th, 2012
XSEDE Scholars Program Introduction to C Programming John Lockman III June 7 th, 2012 Homework 1 Problem 1 Find the error in the following code #include int main(){ } printf(find the error!\n");
More informationBasic Types and Formatted I/O
Basic Types and Formatted I/O C Variables Names (1) Variable Names Names may contain letters, digits and underscores The first character must be a letter or an underscore. the underscore can be used but
More informationC OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed
C Overview C OVERVIEW Goals speed portability allow access to features of the architecture speed C fast executables allows high-level structure without losing access to machine features many popular languages
More informationProgramming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan
Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Outline p Introduction p Program development p C language and beginning with
More informationDECLARATIONS. Character Set, Keywords, Identifiers, Constants, Variables. Designed by Parul Khurana, LIECA.
DECLARATIONS Character Set, Keywords, Identifiers, Constants, Variables Character Set C uses the uppercase letters A to Z. C uses the lowercase letters a to z. C uses digits 0 to 9. C uses certain Special
More informationIntroduction to Computing Lecture 01: Introduction to C
Introduction to Computing Lecture 01: Introduction to C Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical&Electronics Engineering ozbek.nukhet@gmail.com Topics Introduction to C language
More informationBinghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program
Syntax What the Compiler needs to understand your program 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line Possibly replacing it with other
More informationLecture 02 Summary. C/Java Syntax 1/14/2009. Keywords Variable Declarations Data Types Operators Statements. Functions
Lecture 02 Summary C/Java Syntax Keywords Variable Declarations Data Types Operators Statements if, switch, while, do-while, for Functions 1 2 By the end of this lecture, you will be able to identify the
More informationBLM2031 Structured Programming. Zeyneb KURT
BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationC OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure
C Overview Basic C Program Structure C OVERVIEW BASIC C PROGRAM STRUCTURE Goals The function main( )is found in every C program and is where every C program begins speed execution portability C uses braces
More informationLESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:
LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words
More informationA Fast Review of C Essentials Part I
A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types
More informationThe component base of C language. Nguyễn Dũng Faculty of IT Hue College of Science
The component base of C language Nguyễn Dũng Faculty of IT Hue College of Science Content A brief history of C Standard of C Characteristics of C The C compilation model Character set and keyword Data
More informationChapter 2: Overview of C. Problem Solving & Program Design in C
Chapter 2: Overview of C Problem Solving & Program Design in C Addison Wesley is an imprint of Why Learn C? Compact, fast, and powerful High-level Language Standard for program development (wide acceptance)
More informationFundamental of Programming (C)
Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering
More informationSEQUENTIAL STRUCTURE. Erkut ERDEM Hacettepe University October 2010
SEQUENTIAL STRUCTURE Erkut ERDEM Hacettepe University October 2010 History of C C Developed by by Denis M. Ritchie at AT&T Bell Labs from two previous programming languages, BCPL and B Used to develop
More informationIntroduction to the C Programming Language
Introduction to the C Programming Language Michael Griffiths Corporate Information and Computing Services The University of Sheffield Email m.griffiths@sheffield.ac.uk Course Outline Part 1 Introduction
More informationFundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University
Fundamental Data Types CSE 130: Introduction to Programming in C Stony Brook University Program Organization in C The C System C consists of several parts: The C language The preprocessor The compiler
More informationUNIT - I. Introduction to C Programming. BY A. Vijay Bharath
UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been
More informationC Concepts - I/O. Lecture 19 COP 3014 Fall November 29, 2017
C Concepts - I/O Lecture 19 COP 3014 Fall 2017 November 29, 2017 C vs. C++: Some important differences C has been around since around 1970 (or before) C++ was based on the C language While C is not actually
More informationLecture 02 C FUNDAMENTALS
Lecture 02 C FUNDAMENTALS 1 Keywords C Fundamentals auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void
More informationProcedures, Parameters, Values and Variables. Steven R. Bagley
Procedures, Parameters, Values and Variables Steven R. Bagley Recap A Program is a sequence of statements (instructions) Statements executed one-by-one in order Unless it is changed by the programmer e.g.
More informationET156 Introduction to C Programming
ET156 Introduction to C Programming g Unit 22 C Language Elements, Input/output functions, ARITHMETIC EXPRESSIONS AND LIBRARY FUNCTIONS Instructor : Stan Kong Email : skong@itt tech.edutech.edu General
More informationCMPE-013/L. Introduction to C Programming
CMPE-013/L Introduction to C Programming Bryant Wenborg Mairs Spring 2014 What we will cover in 13/L Embedded C on a microcontroller Specific issues with microcontrollers Peripheral usage Reading documentation
More informationINTRODUCTION 1 AND REVIEW
INTRODUTION 1 AND REVIEW hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Programming: Advanced Objectives You will learn: Program structure. Program statements. Datatypes. Pointers. Arrays. Structures.
More informationC Overview Fall 2014 Jinkyu Jeong
C Overview Fall 2014 Jinkyu Jeong (jinkyu@skku.edu) 1 # for preprocessor Indicates where to look for printf() function.h file is a header file #include int main(void) { printf("hello, world!\n");
More informationThe C language. Introductory course #1
The C language Introductory course #1 History of C Born at AT&T Bell Laboratory of USA in 1972. Written by Dennis Ritchie C language was created for designing the UNIX operating system Quickly adopted
More informationIn this session we will cover the following sub-topics: 1.Identifiers 2.Variables 3.Keywords 4.Statements 5.Comments 6.Whitespaces 7.Syntax 8.
In this session we will cover the following sub-topics: 1.Identifiers 2.Variables 3.Keywords 4.Statements 5.Comments 6.Whitespaces 7.Syntax 8.Semantic www.tenouk.com, 1/16 C IDENTIFIERS 1. Is a unique
More informationCharacter Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Uppercase Alphabets Lowercase Alphabets Character Set A, B, C, Y, Z a, b, c, y, z Digits
More informationFundamentals of Programming
Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables
More information.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar..
.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar.. A Simple Program. simple.c: Basics of C /* CPE 101 Fall 2008 */ /* Alex Dekhtyar */ /* A simple program */ /* This is a comment!
More informationDEPARTMENT OF MATHS, MJ COLLEGE
T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,
More informationCMSC 104 -Lecture 5 John Y. Park, adapted by C Grasso
CMSC 104 -Lecture 5 John Y. Park, adapted by C Grasso 1 Topics Naming Variables Declaring Variables Using Variables The Assignment Statement 2 a + b Variables are notthe same thing as variables in algebra.
More informationProgramming in C. What is C?... What is C?
C Programming in C UVic SEng 265 Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier, in 1969, Ritchie and Thompson developed the Unix operating system We will be focusing on a version
More informationProgramming in C UVic SEng 265
Programming in C UVic SEng 265 Daniel M. German Department of Computer Science University of Victoria 1 SEng 265 dmgerman@uvic.ca C Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier,
More informationInteger Representation. Variables. Real Representation. Integer Overflow/Underflow
Variables Integer Representation Variables are used to store a value. The value a variable holds may change over its lifetime. At any point in time a variable stores one value (except quantum computers!)
More informationIntroduction to C programming. By Avani M. Sakhapara Asst Professor, IT Dept, KJSCE
Introduction to C programming By Avani M. Sakhapara Asst Professor, IT Dept, KJSCE Classification of Software Computer Software System Software Application Software Growth of Programming Languages History
More informationProgramming in C. What is C?... What is C?
Programming in C UVic SEng 265 C Developed by Brian Kernighan and Dennis Ritchie of Bell Labs Earlier, in 1969, Ritchie and Thompson developed the Unix operating system We will be focusing on a version
More informationWeek 2 C Fundamentals; Formatted Input/Output; int and float Types
Week 2 C Fundamentals; Formatted Input/Output; int and float Types How Computer Store Numbers int and float Types C Fundamentals General Forms of a C Program Variables, Identifiers and Assignment Formatted
More informationBSM540 Basics of C Language
BSM540 Basics of C Language Chapter 9: Functions I Prof. Manar Mohaisen Department of EEC Engineering Review of the Precedent Lecture Introduce the switch and goto statements Introduce the arrays in C
More informationProgramming. C++ Basics
Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++
More informationVARIABLES AND CONSTANTS
UNIT 3 Structure VARIABLES AND CONSTANTS Variables and Constants 3.0 Introduction 3.1 Objectives 3.2 Character Set 3.3 Identifiers and Keywords 3.3.1 Rules for Forming Identifiers 3.3.2 Keywords 3.4 Data
More informationProgramming in C and Data Structures [15PCD13/23] 1. PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme]
Programming in C and Data Structures [15PCD13/23] 1 PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme] Course objectives: The objectives of this course is to make students
More informationData types, variables, constants
Data types, variables, constants Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic in C 2.6 Decision
More informationUniversity of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.
University of Technology Laser & Optoelectronics Engineering Department C++ Lab. Second week Variables Data Types. The usefulness of the "Hello World" programs shown in the previous section is quite questionable.
More information2. Numbers In, Numbers Out
COMP1917: Computing 1 2. Numbers In, Numbers Out Reading: Moffat, Chapter 2. COMP1917 15s2 2. Numbers In, Numbers Out 1 The Art of Programming Think about the problem Write down a proposed solution Break
More information2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants
Data types, variables, constants Outline.1 Introduction. Text.3 Memory Concepts.4 Naming Convention of Variables.5 Arithmetic in C.6 Type Conversion Definition: Computer Program A Computer program is a
More informationCSE 124 Discussion (10/3) C/C++ Basics
CSE 124 Discussion (10/3) C/C++ Basics Topics - main() function - Compiling with gcc/makefile - Primitives - Structs/Enums - Function calls/loops - C++ Classes/stdtl - Pointers/Arrays - Memory allocation/freeing
More informationWriting an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and
Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and #include The Use of printf() and scanf() The Use of printf()
More informationCMSC 246 Systems Programming
CMSC 246 Systems Programming Spring 2018 Bryn Mawr College Instructor: Deepak Kumar CMSC 246 Systems Programming 1 Go to class web page 3 Goals Learn Linux (CLI, not WIMP!) Learn C Learn Linux tools 4
More informationThe University of Calgary. ENCM 339 Programming Fundamentals Fall 2016
The University of Calgary ENCM 339 Programming Fundamentals Fall 2016 Instructors: S. Norman, and M. Moussavi Wednesday, November 2 7:00 to 9:00 PM The First Letter of your Last Name:! Please Print your
More informationInformática Ingeniería en Electrónica y Automática Industrial
Informática Ingeniería en Electrónica y Automática Industrial Introduction to C programming language V1.1 Alvaro Perales Eceiza Introduction to C programming language Introduction Main features Functions
More informationOutline. Welcome to C Syntax Variables Operations Function calls Control statement More data type Timer examples
C"for"PIC" E155" Outline Welcome to C Syntax Variables Operations Function calls Control statement More data type Timer examples 2 Welcome to C Invented in 1973 by Dennis Ritchie of Bell Labs Its popularity
More informationStorage class and Scope:
Algorithm = Logic + Control + Data Data structures and algorithms Data structures = Ways of systematically arranging information, both abstractly and concretely Algorithms = Methods for constructing, searching,
More informationAbout Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals
More informationComputers Programming Course 5. Iulian Năstac
Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction
More informationTopic 6: A Quick Intro To C
Topic 6: A Quick Intro To C Assumption: All of you know Java. Much of C syntax is the same. Also: Many of you have used C or C++. Goal for this topic: you can write & run a simple C program basic functions
More informationEC 413 Computer Organization
EC 413 Computer Organization C/C++ Language Review Prof. Michel A. Kinsy Programming Languages There are many programming languages available: Pascal, C, C++, Java, Ada, Perl and Python All of these languages
More informationCreating, Compiling and Executing
Shell Commands & Vi Compiling C programs Creating, Compiling and Executing Creating program #i n c l u d e i n t main ( ) { p r i n t f ( AA\n ) ; p r i n t f ( A A\n ) ; p r i n t f ( A
More informationLecture 2. Examples of Software. Programming and Data Structure. Programming Languages. Operating Systems. Sudeshna Sarkar
Examples of Software Programming and Data Structure Lecture 2 Sudeshna Sarkar Read an integer and determine if it is a prime number. A Palindrome recognizer Read in airline route information as a matrix
More informationCSE 303 Lecture 8. Intro to C programming
CSE 303 Lecture 8 Intro to C programming read C Reference Manual pp. Ch. 1, 2.2-2.4, 2.6, 3.1, 5.1, 7.1-7.2, 7.5.1-7.5.4, 7.6-7.9, Ch. 8; Programming in C Ch. 1-6 slides created by Marty Stepp http://www.cs.washington.edu/303/
More informationProgramming Style Guide v1.1
Oregon State University Intro to programming Source Code Style Guide Modified from: OREGON INSTITUTE OF TECHNOLOGY COMPUTER SYSTEMS ENGINEERING TECHNOLOGY Modified by: Joseph Jess Programming Style Guide
More informationThese are reserved words of the C language. For example int, float, if, else, for, while etc.
Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.
More informationFormatted Input/Output
Chapter 3 Formatted Input/Output 1 The printf Function The printf function must be supplied with a format string ( 格式化字串 ), followed by any values that are to be inserted into the string during printing:
More informationFundamentals of C Programming CS Introduction to Programming
Fundamentals of C Programming CS 102 - Introduction to Programming Department of Computer Science and Engineering Faculty of Engineering University of Moratuwa Sri Lanka By: Dilum Bandara, Dr. Sanath Jayasena,
More informationLecture 5: C programming
CSCI-GA.1144-001 PAC II Lecture 5: C programming Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Brian Kernighan Dennis Ritchie In 1972 Dennis Ritchie at Bell Labs writes C and in 1978
More information2. Numbers In, Numbers Out
REGZ9280: Global Education Short Course - Engineering 2. Numbers In, Numbers Out Reading: Moffat, Chapter 2. REGZ9280 14s2 2. Numbers In, Numbers Out 1 The Art of Programming Think about the problem Write
More informationIntroduction to C Programming
Introduction to C Programming Digital Design and Computer Architecture David Money Harris and Sarah L. Harris 2- C Chapter :: Topics Introduction to C Why C? Example Program Compiling and running a
More informationWork relative to other classes
Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language
More informationIECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23.
Subject code - CCP01 Chapt Chapter 1 INTRODUCTION TO C 1. A group of software developed for certain purpose are referred as ---- a. Program b. Variable c. Software d. Data 2. Software is classified into
More informationOnline Judge and C. Roy Chan. January 12, Outline Information Online Judge Introduction to C. CSC2100B Data Structures Tutorial 1
Roy Chan CSC2100B Data Structures Tutorial 1 January 12, 2009 1 / 38 1 Information Your TA team Course Information Assignment 2 Online Judge Writing Your Assignment Program Submitting Your Program Online
More informationLecture 6. Statements
Lecture 6 Statements 1 Statements This chapter introduces the various forms of C++ statements for composing programs You will learn about Expressions Composed instructions Decision instructions Loop instructions
More informationC - Basics, Bitwise Operator. Zhaoguo Wang
C - Basics, Bitwise Operator Zhaoguo Wang Java is the best language!!! NO! C is the best!!!! Languages C Java Python 1972 1995 2000 (2.0) Procedure Object oriented Procedure & object oriented Compiled
More informationMain Program. C Programming Notes. #include <stdio.h> main() { printf( Hello ); } Comments: /* comment */ //comment. Dr. Karne Towson University
C Programming Notes Dr. Karne Towson University Reference for C http://www.cplusplus.com/reference/ Main Program #include main() printf( Hello ); Comments: /* comment */ //comment 1 Data Types
More information