From 3d945f5c0a9fd2ccb18446a7edd0e61134bdfa00 Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Mon, 2 Oct 2017 16:01:49 -0700 Subject: [PATCH 01/11] first C program --- first-c.C | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 first-c.C diff --git a/first-c.C b/first-c.C new file mode 100644 index 0000000..2036d1d --- /dev/null +++ b/first-c.C @@ -0,0 +1,3 @@ +int main(int argc. char** argv) { + +} \ No newline at end of file From 6b7c0f28fa9375a3b8af9e05bc41f8b6d4519f1a Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Tue, 3 Oct 2017 09:36:37 -0700 Subject: [PATCH 02/11] complete first-C language practice --- a.out | Bin 0 -> 4312 bytes first-c.C | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 a.out diff --git a/a.out b/a.out new file mode 100755 index 0000000000000000000000000000000000000000..126e14b029200b958052e42c7d7cd049d5554c4a GIT binary patch literal 4312 zcmeHKO=}ZT6ur|_TiRf=C{j^0ii%cfy67T;3%>?a6b-e42>M9OlngYHCNr1{LN+e4 z%TmN2(4XMOl?zwmrVHJ;6Wj=0i4+mfdGm(MjL~24F5G$V-22|W_nl;OKJI`2JtgAg zMEVmVG6ydMypSSxB1hmAxKh-F&f)?+^!@np1(zLU~VLZ!m?Q@`C%etY8y64`pMO+9izBPLJ( zGNrtx+UV3;UUVW`@0+Q&Uys%$-gMsJQ=npb zT!U;3b$E_%>yU&o=r$9z)0>gG3P|$i3JX89K9=kH`che6rs%j Vo>A!;DHl~Y2 + +// int integerFunction(int input) { +// return 0; +// } +// float floatFunction(float input) { +// return 0.0; +// } +// float mixedFunction(float input) { +// return 0.0; +// } + +int main(int argc, char** argv) { + //return 0; + // argv = [ + // ['g', 'c', 'c'], + // ['a', 'b', 'c'], + // ['g', 'c', 'c'], + // ['h', 'i'] + // ] + // a string is in double quotes + // a character (char) is in single quotes + return 100; + + + // printf("argc is: "); + // printf("%d\n", argc); + // for(int i = 0; i < argc; ++i) { + // printf("%s\n", argv[i]); + // } } \ No newline at end of file From d2004637d76cc046d13be90d181dfabb38e70805 Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Tue, 3 Oct 2017 09:52:41 -0700 Subject: [PATCH 03/11] testing compile environment --- first-c.C | 1 - first_C_programming_assignment.C | 4 ++-- my_output | Bin 0 -> 8496 bytes 3 files changed, 2 insertions(+), 3 deletions(-) create mode 100755 my_output diff --git a/first-c.C b/first-c.C index f670984..742ac72 100644 --- a/first-c.C +++ b/first-c.C @@ -28,7 +28,6 @@ int main(int argc, char** argv) { // a character (char) is in single quotes return 100; - // printf("argc is: "); // printf("%d\n", argc); diff --git a/first_C_programming_assignment.C b/first_C_programming_assignment.C index d93eb5b..28e1a68 100644 --- a/first_C_programming_assignment.C +++ b/first_C_programming_assignment.C @@ -37,12 +37,12 @@ // In order to run a program, you must: // Write this C file // Make it syntactically correct -// Compile the program with gcc my_first_C_program.C -o my_output +// Compile the program with gcc first_C_programming_assignment.C -o my_output // ./my_output #include int main(int argc, char** argv) { - printf("Hello world!"); + printf("Hello world!\n"); } diff --git a/my_output b/my_output new file mode 100755 index 0000000000000000000000000000000000000000..85391a04963a295c22a8fb474e27805d9f0a352f GIT binary patch literal 8496 zcmeHM-%C_M6rR;gQOOk~`ps1`tne4~(1Xw#F0EwcuONb&T=&{8+})MkyQzgBSkOKg z{sBJq)MNiZ5L8qT(SP7uVPMf?Nwj_6y>s2!ReO)-z}cB^&Y3f3zB>bV@A@7x zp;{r9YJ?DBYMl^|goU0EhoLd3l%s=}qBo=C*Em`!p-Q+bVw^54AmwEA#$=_7H=hgZ zqA+q3NJs2fHYr_u-Yq*;$BVRJGcb267vgH@%;8sb-av<7px!PU_yh6 z7ufxHGHE-rb`DO}@mv+}hzdYV-nV5(e$#n3m&)8#4%P9VsCWmIomiKO*f2<0$jqfO z37N{wWIbH@Jl0e^K646jbqwF)|4L~m1PBx%Y4h>EY zYHm0W73U;4FWNa_+#pveGmgwJq~lpf&bqlh;{{=O@b$d-JiYZ)3Q{^#e~TB!eEK&i ze_}lz&#{in_iAML>gDLraBwHAs(k`e`cyKEqvzFud)r3`%U`KR)7QV-dZ=Z_|z61BaFGe?u?_$fZty`~FOPy;N8(BHNf@W}{ z)VYXuHHjbb<#VZ2irJ2nwdS%pC(+*Mz2_gJ4WhSvC+GX`IkZ&%C#A5@{}|1f8TMv# z)bF%;UD)rBi_m;H6mG6>Sk?bXDEmXi+GSW-O=B1^3>XFs1BL;^fMLKeU>GnA7zPXj zh5^ICzsNvqM|g~Rw?&-0V4?u&@3vC#q3rc$47)!34-K3T30R6Hl x4J{$BGUz!U^sxUOgaP?|1Z@you#Tu>KP?Pm3i}o+!aMgMy*&i`-N6Xv{Q*|#&ustz literal 0 HcmV?d00001 From 3e11f9415e617eb9846c1c8fe7117da41c153024 Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Tue, 3 Oct 2017 11:20:45 -0700 Subject: [PATCH 04/11] finish writing notes from yesterday --- first-c.C | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/first-c.C b/first-c.C index 742ac72..7aa2802 100644 --- a/first-c.C +++ b/first-c.C @@ -1,31 +1,37 @@ // Every C program is an operating system process/executable -// Specified the same kind of comments +// C uses the same kind of comments as JavaScript // #includes allow us to combine different files into a single program -// #including can be pointed at a file that you wrote, or ... - +// #including can be pointed at a file that you wrote, or it can be +// pointed at a file someone else wrote. You have to know where the +// file is, and whether or not it is the one you need! #include - -// int integerFunction(int input) { -// return 0; -// } -// float floatFunction(float input) { -// return 0.0; -// } -// float mixedFunction(float input) { -// return 0.0; -// } +/*Lines 10 - 18 are an example of various C primitives +int integerFunction(int input) { + return 0; +} +float floatFunction(float input) { + return 0.0; +} +float mixedFunction(float input) { + return 0.0; +} +*/ int main(int argc, char** argv) { - //return 0; - // argv = [ - // ['g', 'c', 'c'], - // ['a', 'b', 'c'], - // ['g', 'c', 'c'], - // ['h', 'i'] - // ] - // a string is in double quotes - // a character (char) is in single quotes +/* char** means one of two things: + (1) someone is doing something complicated + aka an algorithm with this object (it is a pointer to a pointer) + (2) or it means it is a two-dimensional array >> argv[][] + + argv = [['g', 'c', 'c'], ['a', 'b', 'c'], ['g', 'c', 'c'],['h', 'i']]; + +NOTE: In C, a string is an array of characters. +(1) a string is in double quotes +(2) a character (char) is in single quotes +*/ + +// vvv the simplest possible C program return 100; // printf("argc is: "); From 6b861abda75d5b4dbefe925ae558ca64e8be7333 Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Tue, 3 Oct 2017 12:06:47 -0700 Subject: [PATCH 05/11] notes about main() function --- first_C_programming_assignment.C | 16 ++++++++++++++++ my_output | Bin 8496 -> 8560 bytes 2 files changed, 16 insertions(+) diff --git a/first_C_programming_assignment.C b/first_C_programming_assignment.C index 28e1a68..9bdba22 100644 --- a/first_C_programming_assignment.C +++ b/first_C_programming_assignment.C @@ -42,7 +42,23 @@ #include +// * primitives (int char float double) +int integerFunction(int input) { + return input; +} +// * loops, break, continue +// * branches if else else if, while +// * arrays +// * structs (to become classes) + + +// the main() f(x) invokes other functions within it +// it is the first f(x) to be called when program starts execution +// the diff btwn int main() VS. void main() is that VOID will not return a value to the OS int main(int argc, char** argv) { +// READ ABOUT: Program Status Variable Integer + printf("Hello world!\n"); + return 0; } diff --git a/my_output b/my_output index 85391a04963a295c22a8fb474e27805d9f0a352f..00192bd4df461dfc472b0fba6c2257f29378ce01 100755 GIT binary patch delta 403 zcmdns^ucMu1wjLT1_nk31_oOo1_6VO505i37EE5r>}=`*InRk2JA6rLQxq9O3P@b_;2t2S3UHi#bB+LU;C@&uL& z)d~d$1`eQlO&}Hk;szie1hjz|#&_6k$jZz$*@2&hyR-IBx9gwS!~F6NlkNE{84Wh? z6pcW8YfgwH~n?vH`kz72PT~QP0FaVPSOt}C6 delta 312 zcmez1w83e@1wjXX1_nk31_oUq1_6hS505i38cbfv>}+ZPxwIrT zJ|i_TCAEk_F*h+Yk3kh=Ju|}rIgl|x0Ax(AR`B))nFjHr7?9=%dKTtq8HhN@`(U5~ VB!L__A7UU_$^pbym~5_S4ghB(FN6R9 From 3a107577935ad2ec78acd9b16e6702dec6604970 Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Tue, 3 Oct 2017 14:04:12 -0700 Subject: [PATCH 06/11] integerAddFunction --- first_C_programming_assignment.C | 22 +++++++++++++++++++--- my_output | Bin 8560 -> 8568 bytes 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/first_C_programming_assignment.C b/first_C_programming_assignment.C index 9bdba22..fbd735f 100644 --- a/first_C_programming_assignment.C +++ b/first_C_programming_assignment.C @@ -40,23 +40,39 @@ // Compile the program with gcc first_C_programming_assignment.C -o my_output // ./my_output +// READ ABOUT: vvv Popular Header Files #include + // * primitives (int char float double) -int integerFunction(int input) { - return input; +int integerAddFunction() +{ + int a = 3; + float b = 4.5; + double c = 5.25; + float sum; + + sum = a + b + c; + + printf("The sum of a, b, and c is %f. \n", sum); + return 0; } // * loops, break, continue + // * branches if else else if, while + // * arrays + // * structs (to become classes) // the main() f(x) invokes other functions within it // it is the first f(x) to be called when program starts execution -// the diff btwn int main() VS. void main() is that VOID will not return a value to the OS +// the diff btwn int main() VS. void main() is the return type +// (i.e., VOID will not return a value to the OS int main(int argc, char** argv) { // READ ABOUT: Program Status Variable Integer + integerAddFunction(); printf("Hello world!\n"); return 0; diff --git a/my_output b/my_output index 00192bd4df461dfc472b0fba6c2257f29378ce01..7c12ebcff9d30e5c50e9176cb0de338366552298 100755 GIT binary patch delta 717 zcmez1^uuX_2xG!T(Qw9!iMiH{>=Re23r*l-U|?imU|0#nATWV%;v+jjD}IP58$^)7 zYO*1ty`TeBR0=BUFu9RYNiRRIxCAP|zz`oF;u;YG=Q1QfweUcN5+)Zi$xmLus34dF zmC=LBCgNEyde6x>mOz?SJ3yzCw@WK51;w9T>pILk8u6*nLp~l zCm`d)Cm`c9Q0@&-#P!Vv#uq_A9fl`6U0-yb@Mu1w5PLW+O^;u`1t`kE5bDwS6l5RJ zU=X*n_J>D(XX%F*rT_o`2f85(BnC8u;RP^GPz{;zU-be|%%@lOAdqql{;#?bNKeQB z5)3b&0kwk|Fd*sxlyV5kNL45<%~i-xQ%KZNNYYVA%u7*7R>&+?P)*ZQ;9~Gd&B@7E z;4IHC%1Ke=Vqlm&n_rd}lp0Kc=76x(2Nh+52r}eN zHe|FHEP;wjK}Aa@H!>&&V*awy2gUa-6R%E))$XGD>C$qDt2T+g+h$VpdfC2*p zE09*09LQqNC@^^ST#4x_YW<>#JuE`VlSkgOd|8%?li9O6O@4yi1(fQP)`Hg}{FRMLJHBic< zv-E>U=kW~;FF?*TJlW~`rt^eH^AUyE!xR3i&H;+~^vd=EDaYXdsAfj#+WoVk2 zSCX2ZTI5!mmt2yWpO?vC2MPveh7EE+;(#2G7MR?u;A;ts15g0*GlKjDi4z?#pMk*v d8oEXhaZq%Dfz@PAMO8rzYbHA>nlS?v003IUaYX Date: Tue, 3 Oct 2017 15:59:58 -0700 Subject: [PATCH 07/11] define, populate, print array --- first_C_programming_assignment.C | 42 +++++++++++++++++++++++-------- my_output | Bin 8568 -> 8828 bytes 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/first_C_programming_assignment.C b/first_C_programming_assignment.C index fbd735f..606a736 100644 --- a/first_C_programming_assignment.C +++ b/first_C_programming_assignment.C @@ -1,8 +1,8 @@ /** - * primitives (int char float double) - * loops, break, continue - * branches if else else if, while - * arrays +* primitives (int char float double) +* loops, break, continue +* branches if else else if, while +* arrays * structs (to become classes) * ^^^ ^^^ ^^^ ^^^ ^^^ * Operating Systems C Lesson Assignment 1 @@ -43,8 +43,7 @@ // READ ABOUT: vvv Popular Header Files #include - -// * primitives (int char float double) +// (1) * primitives (int char float double) int integerAddFunction() { int a = 3; @@ -54,16 +53,35 @@ int integerAddFunction() sum = a + b + c; - printf("The sum of a, b, and c is %f. \n", sum); + printf("The sum of a, b, and c is float %f. \n", sum); + return 0; +} +// (2) * loops, break, continue +int whileLoopFunction() +{ return 0; } -// * loops, break, continue -// * branches if else else if, while +// (3) * branches if else else if, while -// * arrays +// (4) * arrays +int printArray() +{ +/* defines an array of 6 integers */ + int numbers[6]; +/* populates the array */ + numbers[0] = 0; + numbers[1] = 1; + numbers[2] = 2; + numbers[3] = 3; + numbers[4] = 4; + numbers[5] = 5; +/* print the 3rd number from the array */ + return printf("The 3rd number in the array is: %d. \n", numbers[3]); + +} -// * structs (to become classes) +// (5) * structs (to become classes) // the main() f(x) invokes other functions within it @@ -74,6 +92,8 @@ int main(int argc, char** argv) { // READ ABOUT: Program Status Variable Integer integerAddFunction(); + printArray(); + printf("Hello world!\n"); return 0; } diff --git a/my_output b/my_output index 7c12ebcff9d30e5c50e9176cb0de338366552298..0efed9619d8a76a950f903082f2216f76ede0476 100755 GIT binary patch delta 1265 zcmZux>q`_-6u&dGldpDXRt<#JoUImoknCdNqL{nk)KF5|143M<(Oum|_tCiP0}3^J zEsL;n{{cT)L4n}6B3Q7nKK5P6L}dj(SVl-h)48)_nswmJ@BV)Gocla?cF+H8O_x&h zGsj*RXUqsu2q7=|fMv`xtLLmVms5}CL_}j3)nerh^^~FVcoJ0ip;$Nm2x_aLb{es* z*iN@tXAM;{)LDFo9-`e8-k=*P2HTm-HrnVSAj|#H_&&#v85es5xCw`uT1Oe5TO@#P zgfm8)Kpr@Y-!M(|T^j#jYC7BpIz0kHRltLQ6M$seGH|CIp#s2Vz*)c|@OJQn#sVR3 z!jr6x%|K+{Oh*ZRW~$<2=@Z@BTz&hCrl&6-QP;C?C?Q!O5Dp zffK6*-{YQzNp>d>r!7Ur2@0XF9M39%I~;FTDE!jWKyBl7OXavL<6Gn^AL#ivrR2Ia zwdItin{5y)rPx08XUk!<|kV)w28(zK+wmGxo)oh%PARlp zAClr)@;xL8zQwfW;9*eBQA`$s+NLYM0C=x!j?aMUAQ3k=V3;7ehRtPY;V!PGu5U1^ z#05uRoluBw1Or07>K7u3a8E!LLJ=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13:09:17 -0700 Subject: [PATCH 08/11] notes --- first_C_programming_assignment.C | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/first_C_programming_assignment.C b/first_C_programming_assignment.C index 606a736..9243691 100644 --- a/first_C_programming_assignment.C +++ b/first_C_programming_assignment.C @@ -52,7 +52,7 @@ int integerAddFunction() float sum; sum = a + b + c; - +// printf stands for 'print formatted' printf("The sum of a, b, and c is float %f. \n", sum); return 0; } @@ -79,6 +79,9 @@ int printArray() /* print the 3rd number from the array */ return printf("The 3rd number in the array is: %d. \n", numbers[3]); + char name[] = "Stevie Magic"; + + } // (5) * structs (to become classes) From 52f7a1a4ae0a351482f88b585825cd6098c85674 Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Thu, 5 Oct 2017 00:32:12 -0400 Subject: [PATCH 09/11] forLoopFunction --- first_C_programming_assignment.C | 18 ++++++++++++++++++ my_output | Bin 8828 -> 8900 bytes 2 files changed, 18 insertions(+) diff --git a/first_C_programming_assignment.C b/first_C_programming_assignment.C index 9243691..6c74589 100644 --- a/first_C_programming_assignment.C +++ b/first_C_programming_assignment.C @@ -57,6 +57,22 @@ int integerAddFunction() return 0; } // (2) * loops, break, continue + +int forLoopFunction() +{ + int A[] = {2, 4, 6, 8}; + int i; + + for (i = 0; i < 4; i++) + { + printf("Address = %d\n", &A[i]); + printf("Address = %d\n", A + i); + printf("Value = %d\n", A[i]); + printf("Value = %d\n", *(A + i)); + } + return 0; +} + int whileLoopFunction() { return 0; @@ -97,6 +113,8 @@ int main(int argc, char** argv) { printArray(); + forLoopFunction(); + printf("Hello world!\n"); return 0; } diff --git a/my_output b/my_output index 0efed9619d8a76a950f903082f2216f76ede0476..26d0f03fe550467cc603541f9bf6034883fa1fe4 100755 GIT binary patch delta 1232 zcmZ8hTWb?R6h0fX^_FDQdO@wNTQT*DG~&IaP0*E9tQWjMi=~!!wZWR!H1!6Ocy|fW z==4F~^dBhoLBxla7Oh3Jf)9O&n2N{>Dp3)NsOvYIt=bOEoO8bK%$YN1&+O05{YrYM zDD5H=h-iZY3r5;?{cTmzpeK)lw8o%^trDt=hHZF}4G(+RIiYG6NqKMChPmxzFU4Y( z6XZhKW@9!hvoc3@VV8}nHrmCG0nOUz92?Dc_c|^MLOY__K~uAcuGRFk4G ziAYV7sw<Izmh6)-uSf@f1rM(rJOsKS7%KfX&w zyF~=vSfU1eC;0c^zo`0iT^WW;4Y)93400drPsUPNU3mp&b$;``al{aaVj#NmEU9Ef zXizgBj+my2JVUr0zd)rjDqWlc&flY+?+@1Z86!O31qrsoQ|t=jxZONzQvAX8cs7>D z`8AS(2NqVXR-PF}cgFKzl%1U7x!uo7)gl`Mr4+GG0W3amt0%r{s~!b{2PZ5^!uPx%3}~Sq>AeYr??Hf_rG%4 z?f1TrSXOl1kdMU+k2Z!Q!~}92ZE4U>YE7Lnt)WG0Y}TT*tj

QAa$8_2EcNJFG>K z$d=AXQ!LyTIZp94huWgs+uGXyK^KH|CtAX-+IUnKD%zun5Q;_{PaUVL=&tl!nna0t zrC4*tT%FIC65#DQ!JDuOg#16t+u~#=KLd$KoN(t~Ebn)2=WIJ<+hc!)I?LuSAnzZs zY@&o6FP6vcqlhj|uy5t<1AiUvOmGDMH)G|@+ zLXg;5pSiB7VNI=*MO0-?J*}zoR+D|fFi*%0{q@T$D6;4@DcJ!|Ahrz*OZhO68MVl`cLm9bN} z>RIk+zVOV`-<42{e@M)r8gC~C_%M-hkr%#%IN@LF7S37JGX3uRz4sd#cZxlk%5+8Yz|{+ zbixR2fNEY?VTj3o^O@hIj$lQZ$6+On(*;r9{ldWxrz=zI?{+xmwfcEg?>rZ+$@lTK jK3-M%mH!v$ry4+~zXi>I3`18FAs&yqduAgOj+g%c`G=)| From ef7c33d044754d0a25880349bfb7243a237c26fa Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Thu, 5 Oct 2017 01:11:27 -0400 Subject: [PATCH 10/11] pointer progress --- first_C_programming_assignment.C | 25 +++++++++++++++++++++---- my_output | Bin 8900 -> 8900 bytes 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/first_C_programming_assignment.C b/first_C_programming_assignment.C index 6c74589..a8bfe47 100644 --- a/first_C_programming_assignment.C +++ b/first_C_programming_assignment.C @@ -54,6 +54,7 @@ int integerAddFunction() sum = a + b + c; // printf stands for 'print formatted' printf("The sum of a, b, and c is float %f. \n", sum); + printf("\n"); return 0; } // (2) * loops, break, continue @@ -61,15 +62,22 @@ int integerAddFunction() int forLoopFunction() { int A[] = {2, 4, 6, 8}; + + + + int i; for (i = 0; i < 4; i++) { printf("Address = %d\n", &A[i]); printf("Address = %d\n", A + i); - printf("Value = %d\n", A[i]); - printf("Value = %d\n", *(A + i)); + printf("Pointer Value = %d\n", A[i]); + printf("Pointer Value = %d\n", *(A + i)); + printf("\n"); } + printf("Total Array Size in Bytes = %d\n", sizeof(A)); + printf("\n"); return 0; } @@ -83,6 +91,15 @@ int whileLoopFunction() // (4) * arrays int printArray() { + printf("Start of PrintArray Function: \n"); + + int A[] = {2, 4, 6, 8}; + printf("Memory Address = %d\n", A); + printf("Memory Address = %d\n", &A[0]); + printf("Pointer Value = %d\n", A[0]); + printf("Pointer Value = %d\n", *A); + printf("\n"); + /* defines an array of 6 integers */ int numbers[6]; /* populates the array */ @@ -111,9 +128,9 @@ int main(int argc, char** argv) { // READ ABOUT: Program Status Variable Integer integerAddFunction(); - printArray(); - forLoopFunction(); + + printArray(); printf("Hello world!\n"); return 0; diff --git a/my_output b/my_output index 26d0f03fe550467cc603541f9bf6034883fa1fe4..69136b4c9da297bc2d35dfa270d5e74662d6c30d 100755 GIT binary patch delta 1144 zcmY*ZTSyd97(TPQ)~dTR8eO$I8%Y@vnq8nUH8?RyQehV|0xj3l%$0Q)G>FYg=rjq| z1QjM&1YIat*cV@-6_?yX!q7l!AGWBNz@XcM5V?J4W`aDh=Rg1VfB$8^*)wq#XMN-O z^*Mw{gb-H-Hmv%bs~>jcwRkKv*8)k4UMf}Ob=v4^8|~D)rHX}vHcD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960024aa5db694479526f8 Mon Sep 17 00:00:00 2001 From: Colombianito66 Date: Thu, 5 Oct 2017 01:30:12 -0400 Subject: [PATCH 11/11] while loop --- first_C_programming_assignment.C | 21 +++++++++++++++------ my_output | Bin 8900 -> 8900 bytes 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/first_C_programming_assignment.C b/first_C_programming_assignment.C index a8bfe47..8443fde 100644 --- a/first_C_programming_assignment.C +++ b/first_C_programming_assignment.C @@ -61,11 +61,8 @@ int integerAddFunction() int forLoopFunction() { + printf("Start of forLoop Function: \n"); int A[] = {2, 4, 6, 8}; - - - - int i; for (i = 0; i < 4; i++) @@ -83,6 +80,17 @@ int forLoopFunction() int whileLoopFunction() { + printf("Start of WhileLoop Function: \n"); + char A[7] = "Steven"; + int i = 0; + + while(A[i] != '\0') + { + printf("%c", A[i]); + printf("\n"); + i++; + } + printf("\n"); return 0; } @@ -129,10 +137,11 @@ int main(int argc, char** argv) { integerAddFunction(); forLoopFunction(); + + whileLoopFunction(); printArray(); printf("Hello world!\n"); return 0; -} - +} \ No newline at end of file diff --git a/my_output b/my_output index 69136b4c9da297bc2d35dfa270d5e74662d6c30d..8d49f1836635543f6fcea047aa42c59af02e21b9 100755 GIT binary patch delta 1279 zcmZ9MUuYCZ9LMK2ZqbW(dq<)e|1^8S1OGs|hz8NdMC_DNa$*}}ix9mwiPa60TK#779pS75-G@PGB^o^V~zr7K-X>O{S-DID|YMvuls7Bt~e z-J=OH4chO~8d)4)zlbPJ;UUef%Uno?#2HZAqiZ~B59gKRN@!uOH*sWS_m{UC4#)Qe z$$b%1Hz`wr;iKvssz_8;hQrGUd8UQbBKH2b777%_=aoCFdf>5K<0BYO?Q6t7ULhtb z^~@o_U!-QLYgK6o<8%r7#xiW|l!o_N%xwJFo!S$$Ah*QngKS>`ixDmN4Mr5o$%q`a zSVz3T@_#7IH_7;I6#HE%>!-_l9J&F07J6oZ@%xNpN|wi?Mlha{8R+3zNfDkOuTQIMUIm^*54 z9A-AK-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