![]() int: for integers (whole numbers) such as 123 and -456.The name is needed to uniquely identify each variable, so as to assign a value to the variable (e.g., radius=1.2), and retrieve the value stored (e.g., area = radius*radius*3.1416). A variable has a name (or identifier), e.g., radius, area, age, height.In other words, a variable has a name, a type and stores a value. More precisely, a variable is a named storage location, that stores a value of a particular data type. It is called variable because you can change the value stored. A variable is used to store a piece of data for processing. Variables and Types VariablesĬomputer programs manipulate (or process) data. In almost all of the C programs, we use #include to include the input/output stream library header into our program, so as to use the IO library function to carry out input/output operations (such as printf() and scanf()). #define PI 3.14159265 // To substitute the term PI with 3.14159265 in this file // DO NOT terminate preprocessor directive with a semi-colon #include // To include the Math library header #include // To include the IO library header Preprocessor directives are not programming statements, and therefore should NOT be terminated with a semi-colon. (Why not ends with a period like an english sentence? This is because period crashes with decimal point - it is hard for the dumb computer to differentiate between period and decimal point!)įor examples, // Each of the following lines is a programming statement, which ends with a semi-colon ( )īlock: A block (or a compound statement) is a group of statements surrounded by braces Ĭ source code is preprocessed before it is compiled into object code (as illustrated).Ī preprocessor directive, which begins with a # sign (such as #include, #define), tells the preprocessor to perform a certain action (such as including a header file, or performing text replacement), before compiling the source code into object code. ![]() A programming statement must be terminated by a semi-colon ( ), just like an English sentence ends with a period. It performs a piece of programming action. Statement: A programming statement is the smallest independent unit in a program, just like a sentence in the English language. During program development, instead of deleting a chunk of statements permanently, you could comment-out these statements so that you could get them back later, if needed. ![]() You should use comments liberally to explain and document your codes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |