Posts

1.16 The C Character Set or Characters of lexical set

  The C Character Set or Characters of lexical set: - Character set is a set of alphabets, digits and some special characters that are valid in C language. A program requires all these when designing it. Alphabets                               Uppercase: A B C  ......................... X Y Z                               Lowercase: a b c  ......................  x y z                          C accepts both lowercase and uppercase alphabets as variables and functions.   Digits                                              ...

1.15 Executing a ' C ' Program.

Image
  Executing a ' C ' Program. Executing a program written in C involves a series of steps. These are: Creating the C program. Compiling the C program. Linking the C program. Executing the C program. 1) Creating the C program: - An editor like notepad, WordPad, or Editplus etc. are used to create or write a c program. The code which we have written inside the editor is known as source code and should saved with “.c” extension. 2) Compiling the C program: - After writing the source code in editor, which is ready for compilation process. The source code is compiled by the compilers. The compiler converts C source high level code to low level code as assembly source code. Then assembler is ready to convert assembly source code to binary code, which code was well understandable by computer machine. i.e. object code.   3) Linking the C program: - In this step, the object code of a C program is linked with libraries that are needed for execution of a ...

1.14 Programming Style

Programming Style: -   A good programming style in C helps make your code readable, understandable, and easy to maintain. It is important to use consistent indentation throughout your code. (spaces or tabs, but not both). Always use meaningful names for your variables and functions. For instance, use student_Count instead of a value name like a. Adding comments in your code helps others understand the logic. Choose a brace style and stick to it consistently. Try to keep each line of code reasonably short, ideally under 80 to 100 characters, so that it fits on the screen without scrolling.   Break your program into smaller functions, where each function performs a single specific task. This makes your code modular and easier to debug or reuse. Avoid using magic numbers in your code. Instead, use constants or macros declared with #define or const variables to make your code more understandable. Use proper spacing around operators and after commas to improve readability. For ex...

1.13 Basic Structure of C Program

Image
  v    Basic Structure of C Programs: - Basic structure of c program consists of several sections. 1.        Documentation Section. 2.        Link Section. 3.        Definition Section. 4.        Global Declaration Section. 5.        Function Prototype Declaration Section. 6.        Main Function 7.        Sub Function section. 1)      Documentation Section: - Ø    Documentation section includes comments about the C program. Ø    Comments improve readability and understandability of the programmer. Ø    We can give comments about program, creation, modified date, author name, etc. in this section. Ø    Comment lines are ignored by compiler while C program was compiled. Ø    Comments can be of two ...