Tuesday, 20 September 2016

Love the Synthax

In this post you'll understand all basic syntaxes of decision, looping, array, and function in C program language. For understanding the matery, we'll use Codelite.




What's Decision ? 
Decision making structures require that the programmer specifies one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.

first step : open Codelite, make a workspace and a project


IF (one statement)





IF . . . ELSE ( two or more statements )







What's Looping ? 
In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached. Typically, a certain process is done, such as getting an item of data and changing it, and then some condition is checked such as whether a counter has reached a prescribed number. 

first step : open Codelite, make a workspace and a project

WHILE LOOP (used for data which is still not sure)

note : why we need n++ because if there's not, it would be infinite loop (no stop)

DO WHILE LOOP



FOR LOOP  (used for data which is sure)



What's Array ? 
An array is a collection of data items, all of the same type, accessed using a common name. Arrays may be initialized when they are declared, just as any other variables.

first step : open Codelite, make a workspace and a project



What's function ? 
A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions.

first step : open Codelite, make a workspace and a project







Reference(s) :
http://www.tutorialspoint.com/cprogramming/c_decision_making.htm
http://whatis.techtarget.com/definition/loop
https://www.cs.uic.edu/~jbell/CourseNotes/C_Programming/Arrays.html
http://www.tutorialspoint.com/cprogramming/c_functions.htm
http://www.learn-c.org/en/Arrays

No comments:

Post a Comment