Computer Fundamentals Index

Computer Introduction Types of computer Characteristics of computer Uses of computer History of Computers

Computer Languages

Low Level language Middle level Language High level language

Computer Generation

Generation of Computers First Generation of Computer Second generation of Computers Third generation of Computers Fourth generation of Computers Fifth generation of Computers Sixth Generation of Computer

Peripheral Devices

Input devices Output device

Components

Block diagram and basic components Control processing unit (CPU) Software Hardware

Memory

Computer Memory Registers Memory Hierarchy RAM Vs ROM Understanding file sizes (Bytes, KB, MB, GB, TB, PB, EB, ZB, YB)

Computer Network

Types of Network Types of Area Networks (LAN, WAN, MAN) TCP Flags

Computer Virus

Computer Virus

Computer Ports

Computer Ports

How

How to hack a computer How much do Computer Programmers make How does a Computer work How to associate a file with a program How does a computer convert text into binary How does a computer process data into information How to fix a CD-ROM DVD How to fix the no input signal How to install computer memory How to associate a file with a program How to log out of your operating system How do I change my name on Google How to installation or uninstallation Microsoft Paint How to fix a not a valid Win32 application error How to fix missing Microsoft Windows .dll files How to use a computer keyboard How to erase my hard drive and start over How can I test how many words I can write a minute How to shut down a computer How do I open and edit the Windows registry How to edit the registry from the command line How to restart Microsoft Windows How to install a computer processor How to open Microsoft Paint How to fix problems in Windows after installing new software How to enable or disable the preview pane of Microsoft Outlook How to open a Microsoft .wps or Works file in Word How to view the HTML source code in Microsoft Word How to View or Change the Screen Resolution of a Monitor How to Connect and Install a Computer Keyboard How to Delete Temporary Files in Windows 10 How to determine Which Version of Microsoft Office I'm using How to find out how much hard drive space is available How to Fix PC Stuck on Verifying DMI Pool Data How to choose which items show in the notification area How to find similar images using Search by Image How to fix Low Memory and out of memory errors How To Replace the CMOS Battery How do I Update my Antivirus Program How to fix a general protection fault How to Identify problems in the Windows Device Manager How can the Base be Shown How to test if a Website or Web Page is down How Much is 1 Byte, Kilobyte, Megabyte, Gigabyte, etc How to fix a CMOS checksum error How to Fix a Windows CD-ROM, DVD, or Disc Drive Issue How to Open Safe Mode How to Password Protect Files and Folders in Windows How to Reset CMOS or BIOS Settings How to use Computer Keyboard How to create a text file How to enable or disable DHCP in Windows How to test computer memory to determine if its bad How do double space or change line spacing in Microsoft Word How do I know if I have Windows Administrator Rights How many cores does my computer have How to Create a Directory or Folder How to Enter and Exit the BIOS or CMOS Setup How to change Windows Compatibility mode How to clear your internet browser history How to Connect Computer Speakers How to Copy a Web Page Link or URL How to install a Hard Drive or SSD How to Open the Windows Control Panel How to split a screen in Windows How to copy text from a scanned PDF

Questions

Who invented Computer What are the advantages of the Internet? What are the disadvantages of the Internet? Is my computer 64 bit? What is Edge Computing? What is a Router? What is Monitor What is Printer What is a Web Browser What is Microphone What is a Webcam What is PC What is Keyboard What is Motherboard What is WAP What is URL What is a Digital Assistant When was the first Computer Invented What is Modem What is Firmware What is Imperative Programming What is Protocol What is Safe Mode What is Device Driver What is Hybrid Topology What is Mesh Topology What is Procedural language What is a hyperlink What is a Username Who invented the Internet What is Video Card What is Sound Card What is Binary What does Alt+B do What does Alt+D do What does Alt+E do What does Alt+Esc do What does Alt+R do What does ALT + Q do What does Alt + Tab do What is Data Manipulation What is a touch screen What is Back Panel What is Analog Monitor What is AR lens What is an ATX Style Connector What is a File System What is Hard Disk Drive (HDD) What is a boot device What is accessibility What is Line In What is network Interface card (NIC) What is Optical Disk Where can I ask questions on the internet What is Auto Rotate What is CAD (Computer-aided design) What is Cable Modem What is Home Page What is boot menu What is braille reader What is flash memory What is Windows What is Clipboard What is Cyber Warfare What is Myspace Why has my IP address changed What is Jacquard Loom My computer is running slow, what steps can I do to fix it What is a Kensington Lock What is a multicore processor What is automation Are smartphones and tablets computers What is a Login Script What is a Loosely Typed Language What is Multitasking? Why my computer monitor shows no display or black screen What is REM What is Parallelization What is Overtype mode What is open with What is Bracket What is an Online Service What is REM What is Parallelization What is Overtype mode What is open with What is Bracket What is an Online Service What is the Pg Dn Key (Page Down Key) What is the Pg up Key (Page up Key) What is Palmtop Computer What is a Processing Device What is a Print Preview What is the Print Screen Key What can I do if my computer or laptop is lost or stolen What is a Model Number What are the currently available antivirus programs What are Toggle keys What is a Case fan What is a Silicon Chip What is a Slate PC What is a TAB stop What is an Octothorpe What is Task Pane What is Task View What is the svchost.exe file used for in Windows Where can I find free online virus scanners Why am I unable to increase the resolution in Windows What is Autofill When I click my mouse, it sometimes double-clicks What is Scratch What is UDIMM What is MsConfig What is an Expansion Card What is an Executable File What is an Elevated Command Prompt What is an AC Adapter What is AIMBOT What is a Software Suite What is a LED Monitor What does Alt + X do What does alt + space do What does Alt + O do Now that I’ve got a Computer, what can i do What is a Punch Card What is RDIMM What is Select All What is Serial number What is Thermos flask What programs can I use for speech recognition What are the Advantages of Computers What are the Disadvantages of Computers What does Alt + T do What Hardware Device Drivers should be Updated What is a Desktop What is a Ring Topology What is CMOS What is a Directory What is a Mechanical Mouse What is a Plotter What is a Variable What is an Icon What is Data What is HDMI What is Remote What is Right-Click What is SMPS Why does my Laptop not turn on What is a Copyright What is a Cordless Mouse What is a CSV file What is a Joystick What is a Start Button What is a Taskbar What is an Alignment What is an Output Device What is Cat 5 What is Google Chrome What is Post What are Recordable DVD Drives What Does Alt + F4 Do What Does Alt + L Do What is a bit (Binary Digit) What is a cable What is a Calculator What is a capacitor What is a Cold Boot What is a Dialog Box What is a Dual-boot What is a Slide What is A4 What is AM What is Barcode Reader What is EHCI What is a Header What is a Joystick What is a Secondary Storage Device What is Access Time What is Account Sharing What is an Asterisk What is Asynchronous DRAM What is Back Quote What is BIOS What is Borderless Printing What is Case Badge What is CD-ROM What is Chat Slang What is Composite What is RJ Cable What Are Bottom Row Keys What is SAN What is Tray What is VDU What Does Alt + M Do What Does Alt + P Do What is a Cell What is a Command Key What is a key Combination What is a Menu Bar What is a Startup What is a T What is Chat What are the F1 through F12 keys What does Alt + Enter do What Does Alt + Home DO What does Alt + R do What does Ctrl + B do What Does Ctrl + Enter Do What Does Ctrl + R Do What does Ctrl + G do What does Ctrl + 9 do What does Ctrl + End do What does Ctrl + O do What Does Ctrl + P do What Does Ctrl + Q do What is a Colon What is a Core What is Apple Touch Icon What is Clock What is Code What is Computer Crime What is Ctrl What is DAT What is Data diddling What is Date Why won't my computer turn on What Does Alt + N Do What does ctrl + 2 do What does ctrl + space do What does Ctrl + W do What does Ctrl + T Do What Does Ctrl + 2 do What does Ctrl + 5 Do What are the most common file types and file extensions What are Sticky keys What Does Ctrl + Shift + Esc Do What is Settings What is Task Manager What is Taskbar What is a DNS Resolver What does ctrl + 1 do What does ctrl + 0 do How to install software What is a Folder What is a Legend What is a MAC Address What is a Path What is a Ruler What is a Toolbar What is an Intranet Meaning and Differences with Internet What is an SSD What is Inheritance What is Tablet What is Depth What is Docking Station What is Double Click What is a Solid Ink Printer What is a Temporary File What is Backup and Restore What is Electronic Payment Systems Eps What is Marshalling

Difference

Difference between hardware and software Difference between multiprocessor and distributed systems Difference between Desktop and Laptop Difference between File and folder Difference between Hard Copy and Soft Copy Open Source Programs vs Closed Source Programs Difference between Optical Fibre and Coaxial Cable Difference between Website and Webpage Difference between Classes and Objects Input VS Output Difference between Primary and Secondary Storage with Examples

Misc

Quantum Computing Computer Software Autoexec.bat and config.sys info Update an Antivirus Use of Internet Advantages and disadvantages of Email Computing Power Internet Explorer Shortcut Keys Advanced Encryption Standard (AES) Augmented Reality Infrastructure Readiness Check Top 10 Internet tips and tricks Introduction and Features of FoxPro Features of Multimedia Top 10 online services and applications Receiving S.M.A.R.T. status bad backup and replacing error Version Control System Uninstalling Software or Apps in Windows Data Warehouse Increase or decrease font size in Word using keyboard shortcuts Mouse not detected or working in Windows Computer Cleaning Information and Steps Function Keys on Keyboard Windows 7 Alt+Tab won’t stay on top or stick 10 Essential Examples of Web Browsers Binary Subtraction using 2’s Complement Case Sensitive Languages Computer Pioneers and people who are CEO Microsoft Word Shortcut Keys Parts of Computers Names, Definitions and Images ROM and its Types Basics of Information Technology Characteristics of a Good Software Design Characteristics of Management Information System Classification of Management Information System Implementation of MIS Input Devices of Computer Definition Limitations of Management Information System 3 Types Of Network in Computer Block Diagram Of Control Unit

What is a Procedural Language?

A procedural language is a type of computer programming language that follows a procedure, collection of instructions or principles that must be followed for the seamless execution of the program. It operates step-by-step and requires the user to indicate what actions to take and how to execute them. Its fundamental concept revolves around having a program outline the series of steps required to implement a particular algorithm. Consequently, procedural languages are founded on algorithms. In this approach, developers employ variables, loops, and functions to construct a program that accomplishes a specific task, performing calculations and presenting the desired result.

What is a Procedural Language?

It adheres to a top-down methodology and progresses in a predetermined sequence with a definitive starting and ending point. The entire program is partitioned into functions, primarily emphasizing these functions exclusively. The code executes straightforwardly with logical steps. The code is written first and then executed with some conditions in this procedural programming. All the procedures call to decide the conditions. There are no data abstraction features in the procedural language like in object-oriented programming. It is a command-driven language and is operated employing commands keyed in by the user or issued by the program. In procedural programming, iterative and recursive calls both functions are used.

Furthermore, it works through the machine's state and returns only restricted data types and allowed values. Despite the large program size, it is highly efficient and unsuitable for critical applications with complex code. It requires a lot of time, but it needs very little memory. In the realm of procedural programming, access specifiers are not present.

Examples of Procedural Language:

Some examples of procedural code in different languages illustrate common features. FORTRAN, C, Java, PASCAL, ALGOL, and BASIC are some examples of procedural languages described below.

FORTRAN

FORTRAN, also known as FORmula TRANslation, is a popular programming language for high-performance computing and scientific engineering calculations. This programming language is designed to cater to numerical computations and scientific analyses, making it an optimal selection. It adheres to a structured and imperative methodology, enabling users to effectively execute intricate mathematical procedures. Developed by IBM in 1950, the FORTRAN language was initially intended for scientific and engineering applications. Presented below are a few snippets of code that exemplify its syntax.

Example:

program sum

    integer i, j, sum

    i = 5

    j = 10

    sum = i + j

    print *, "The sum is:", sum

end program sum

C Language

C is a versatile programming language that finds extensive usage in software development. It was developed at Bell Laboratory by Dennis Ritchie in 1972. C is an arranged programming language not tied to any specific machine. Its reputation lies in its persistent nature, making it particularly favoured for system programming and embedded systems. C is a centric language that can create diverse applications like the Windows operating system and complex programs like Oracle database, Git, Python interpreter, and many more. Positioned as a language of intermediate complexity, C caters to the needs of crafting system software, demanding advanced programming skills to effectively comprehend and construct desired code. Let us quickly look at a sample code snippet:

Example:

#include <stdio.h>

int main() {

    int age = 26;

    if (age >= 18) {

        printf("You can vote.\n");

    } else {

        printf("You can’t vote.\n");

    }

    for (int i = 1; i <= 10; i++) {

        printf("%d ", i);

    }

    return 0;

}

BASIC

BASIC represents Beginners’ All-inclusive Symbolic Instruction Code. It is a collection of versatile, elevated-level programming dialects crafted for simple utilization. The primary rendition originated from the minds of John G. Kemeny and Thomas E. Kurtz at Dartmouth College in 1963. BASIC is among the most straightforward elevated-level languages, with instructions akin to English, making it effortlessly acquired even by youngsters and fledgling programmers.

BASIC is unstructured, later procedural, eventually evolving into an object-oriented programming language influenced by ALGOL 60, FORTRAN II, and JOSS. It has extensive employment in software development and is particularly favoured for system programming and embedded systems. BASIC is also extensively used to create diverse applications, operating systems such as Windows, and numerous intricate programs, including the Oracle database, Git, Python interpreter, etc.

Example:

PRINT "Hello, world!"

Pascal

Pascal is an easy-to-learn programming language. The software it develops produces clear, effective, and reliable applications. It is an inevitable and procedural programming language engineered by Niklaus Wirth. The primary objective is to advocate for effective programming methodologies by leveraging structured programming and efficient data organization. Pascal is named after the French mathematician, philosopher, and physicist Blaise Pascal.

Pascal is a tiny yet effective tongue promoting desirable programming practices through structured and data structuring. Each object possesses strong typing, meaning converting or interpreting one data type as another type is impossible without explicit conversions. Pascal can handle unlimited nested procedure definitions; most definitions and declarations are encapsulated within subroutines. Pascal was derived from the ALGOL 60 programming language.

Apart from ALGOL's scalars and arrays, Pascal allows for creating intricate data types and establishing flexible and iterative data arrangements such as collections, hierarchies, and networks. Pascal gained immense popularity in the mid-1970s and experienced rapid growth in the minicomputer market. Throughout the 1980s, this language became widely used as a teaching tool for programming courses at the university level. Additionally, it found extensive applications in professional settings for developing commercial software.

In the late 1980s and early 1990s, with the growing popularity of UNIX-based systems, the C programming language took over, especially with the introduction of C++.

Example:

program Greeting;

begin

    writeln('Hello, Pascal!');

end.

ALGOL

ALGOL is the abbreviation of Algorithmic Language. It is used for scientific calculation purposes. The programming language in question is procedural, which a committee from the International Association of Computing Machinery crafted. This committee, spearheaded by Alan J. Perlis from Carnegie Mellon University, diligently worked on the language's development between 1958 and 1960. Their primary objective was to create a tool that would facilitate the publication of algorithms and enable computational tasks. ALGOL became an all-encompassing language and stood out as one of the early high-level programming languages to adopt block structure. Over time, the block framework has developed into a formidable instrument for creating expansive software systems by piecing together compact elements.

ALGOL came with the concept of iterative subroutines, which were functions that could be called upon to tackle a challenge by dividing it into more manageable challenges of a similar nature. This characteristic was likewise present in LISP. ALGOL played a significant role in introducing the Backus-Naur Form notation for elucidating the framework of a programming language. This notation ultimately emerged as the prevailing technique for articulating programming languages' syntax in various forms.

ALGOL gained immense popularity across Europe, being the preferred choice of most users due to its advanced functionality. It retained its position as the primary language for sharing computer algorithms for an extended period. Many other languages, such as Pascal, are incarnated from it.

Example:

BEGIN

    OUTSTRING("Hello ALGOL!");

END.

COBOL

COBOL is the abbreviation of COmmon Business-Oriented Language. Reading, writing, and understanding are easily achievable tasks by learning this language. It is designed for Business Applications. COBOL, an English-like compiled computer programming language, is specifically designed for business-oriented tasks. Since its inception in 2002, this language has become an indispensable tool, combining imperative, procedural, and object-oriented approaches. COBOL finds its primary application in the corporate and governmental sectors, specifically in business, financial, and administrative systems.

In 1959, the COBOL programming language appeared through CODASYL, drawing inspiration from Grace Hopper's FLOW-MATIC programming language. As a contribution to a US undertaking, the Defense Department is creating a compact programming language for data processing. Initially, it was perceived as a short-term solution; however, the Department of Defense swiftly compelled computer producers to furnish it, leading to its wide acceptance.

It pioneered the block structure, a powerful tool for constructing large programs from small components. COBOL has also played a significant role in introducing the Backus-Naur Form notation for elucidating the framework of a programming language. This innovative approach eventually emerged as the universally accepted method for delineating the syntax of programming languages across various implementations.

The statements presented in MOVE x TO y format employ a syntax resembling prose that aims to be easily understandable and self-explanatory. However, it is quite wordy and has more than 300 restricted terms. This stands in stark contrast to the succinct and mathematically driven structure of alternative languages.

Mainframe applications rely heavily on its widespread usage, especially in executing extensive batch and transaction processing tasks. Until 2006, numerous prominent financial institutions created fresh systems using this language. However, at present, the majority of COBOL programming is primarily dedicated to upkeeping and preserving current applications. Software programs are currently undergoing migration to novel platforms, undergoing rewriting using contemporary coding languages, or being substituted with alternative software solutions.

Example:

IDENTIFICATION DIVISION.

PROGRAM-ID. CUSTOMER-INFO.

ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

FILE-CONTROL.

    SELECT CUSTOMER-FILE ASSIGN TO "CUSTOMERS.DAT"

        ORGANIZATION IS LINE SEQUENTIAL.

DATA DIVISION.

FILE SECTION.

FD CUSTOMER-FILE.

    01 CUSTOMER-RECORD.

        05 CUST-ID PIC 9(6).

        05 CUST-NAME PIC X(25).

        05 CUST-CITY PIC X(20).

        05 CUST-STATE PIC XX.

WORKING-STORAGE SECTION.

    01 EOF-FLAG PIC X VALUE 'N'.

PROCEDURE DIVISION.

    OPEN INPUT CUSTOMER-FILE.

    READ CUSTOMER-FILE INTO CUSTOMER-RECORD

        AT END MOVE 'Y' TO EOF-FLAG.

    PERFORM UNTIL EOF-FLAG = 'Y'

        DISPLAY "Customer ID: " CUSTOMER-ID

        DISPLAY "Customer Name: " CUSTOMER-NAME

        DISPLAY "City: " CUSTOMER-CITY

        DISPLAY "State: " CUSTOMER-STATE

        READ CUSTOMER-FILE INTO CUSTOMER-RECORD

            AT END MOVE 'Y' TO EOF-FLAG

    END-PERFORM.

    CLOSE CUSTOMER-FILE.

    STOP RUN.

Java

Java, an all-encompassing language, showcases its versatility. It leverages the Just In Time compiler to transform source code into machine code. Introduced in 1995 and owned by Oracle, Java has gained immense popularity as an object-oriented programming language. Its applications encompass various domains, including mobile, desktop, web, game development, and database management. With over 3 billion devices running Java, it has become one of the most widely used programming languages globally.

One of the remarkable characteristics of this technology lies in its capability to achieve compatibility across different platforms. This means once the Java code is compiled, it can be run on any platform that offers Java support without recompilation. Moreover, Java is an open-source language that is freely accessible to everyone, ensuring inclusivity. The programming world warmly embraces newcomers, thanks to its simplicity and easily comprehensible learning process. Along with its user-friendly nature, Java greatly emphasises security, speed, and reliability. It proudly boasts a vast support network comprising millions of developers from all around the globe.

Example:

public class HelloJava {

    public static void main(String[] args) {

        System.out.println("Hello, Java!");

    }

}

Ada

Ada is an advanced programming language created by Honeywell through a partnership with the United States Department of Defense from 1977 to 1983. Jean Ichbiah, a renowned computer scientist from France, was the driving force behind its development. Ada is a well-organized, statically classified, essential, object-based coding language with inherent backing for design by contract, exceptionally robust typing, unequivocal concurrency, undertakings, concurrent message communication, safeguarded entities, and unpredictability. Due to their joint endeavours, Ada has been acknowledged as an international technical standard by the International Organization for Standardization and the International Electrotechnical Commission.

If you are interested in learning Ada, you can start with the basics of Ada, its features and advantages, and how to get started with this tutorial from AdaCore.

Example:

with Ada.Text_IO; use Ada.Text_IO;

procedure Hello is

begin

   Put_Line("Hello, World!");

end Hello;

Advantages of Procedural Programming

Procedural programming offers numerous benefits. Due to its ease of understanding and implementation has become a favored approach for imparting programming concepts. Procedural programs are also efficient and fast since they do not require a lot of memory or processing power.

What is a Procedural Language?
  • In procedural programming, programs are segregated into petite codes, rendering them more comprehensible and amendable. The program is categorized into functions, mainly focusing on functions. The code executes straightforwardly with logical steps. In this procedural language, the code is written first and executed with a few conditions.
  • The procedure calls to decide the conditions. There are no data-hiding features in procedural language. It is a command-driven language and is operated utilizing commands keyed in by the user or issued by the program. In procedural programming, iterative and recursive call functions are both used. It executes according to the machine’s states.
  • It returns data types that are restricted and the allowed values. It is highly efficient even though the program size is large and unsuitable for critical applications with complex code. It takes a lot of time but needs very little memory. In procedural language, no access specifiers are used. For example, in structure, all the members are public.

Disadvantages of Procedural Languages

Procedural programming has several disadvantages. When Procedural Programming is used, the program code becomes more difficult to write. Since procedural code often cannot be reused, it might be essential to replicate it in a different application if needed. It is difficult to relate to real-world objects. The data-sensitive cases might encounter difficulties due to the prioritization of the operation above the data. The information is vulnerable to the entire software, compromising its security level.

  • Complex Maintaining Large Systems: As procedural programs grow in size and complexity, they become increasingly challenging to maintain and modify. Tracking data flow and dependencies across multiple procedures can be cumbersome.
  • Mismatch with Real-World Modeling: When considering the intricate systems and object-oriented approaches, it becomes apparent that our conventional perception of tangible entities and their connections does not seamlessly correspond with procedural programming. Consequently, navigating through intricate models or engaging with object-oriented paradigms may be less instinctive.
  • Limited Code Reusability: Procedural programming languages primarily emphasize sequential directives, implying that frequently the identical code has to be reiterated for diverse assignments. Consequently, this may result in code replication, complicating the task of preserving and enhancing the program.
  • Data Security Concerns: Unlike a few contemporary languages constructed with security as a priority, procedural languages frequently lack intrinsic mechanisms for addressing prevalent security issues such as memory administration, buffer overflows, and susceptibility to SQL injection. Programmers must manually establish these protective measures, which can consume a significant amount of time and are prone to mistakes.
  • Limited Scalability: Dealing with the ever-growing intricacy of contemporary software systems can present obstacles to structural planning. Adjusting to evolving demands or incorporating fresh features can be perplexing without significantly reorganizing the code.
  • Limited Abstraction: Procedural programming, unlike Object-Oriented Programming, offers minimal data abstraction and encapsulation capabilities. Consequently, the code lacks organization, rendering it challenging to modify and reuse.
  • Debugging Challenges: In complex systems, identifying faults can consume significant time due to the presence of interconnected tasks and data. The debugging process frequently involves conducting manual code and data flow assessments.
  • Poor Modularity: When confronted with complex programs, a clear separation between data and functions can present a considerable obstacle. Consequently, modifying a specific code segment may inadvertently impact other parts, thereby introducing further complications in troubleshooting and upgrading.

Key Features of Procedural Programming

Some key features of procedural programming are described below in detail:

What is a Procedural Language?

Pre-defined Functions

In the realm of procedural programming, a prearranged function serves as a function that is at one's disposal within a procedural programming language sourced from a collection of available functions. These functions enable a programmer to accomplish common tasks without producing the necessary code, facilitating time-saving measures during production.

To illustrate, printf() is a prearranged function in the C programming language responsible for printing output to the console. In the realm of C programming, this particular function forms an integral component of the array of functions provided by the standard library.

Example

#include <stdio.h>

int main() {

    printf("Hello, Vivek!");

    return 0;

}

Local Variable

In the context of procedural programming, a localized variable embodies a variable confined solely to the function in which it is defined. Its purpose lies in storing transient values specifically required within a particular fragment of a program.

Example

#include <stdio.h>

int main() {

    int x = 15; // local variable

printf("The value of x is %d", x);

    return 0;

}

Global Variable

On the contrary, a global variable is declared outside of any function and can be reached by any function in the program.

Example.

#include <stdio.h>

int x = 10; // global variable declaration

int main() {

    printf("The value of x is %d", x);

    return 0;

}

Modularity

Modularity, in the realm of procedural programming, conveys the idea of fragmenting a program into smaller, more manageable components referred to as modules. These self-contained modules can be reused in disparate sections or other programs. The underlying notion behind modularity revolves around rendering the program more understandable, maintainable, and conducive to debugging efforts.

#include <stdio.h>

int sum(int a, int b) {

    return a + b;

}

int difference(int a, int b) {

    return a - b;

}

int main() {

    int x = 12, y = 7;

    printf("Sum of %d and %d is %d\n", x, y, sum(x, y));

    printf("Difference between %d and %d is %d\n", x, y, difference(x, y));

    return 0;

}

Parameter Passing

In the realm of procedural programming, the technique of passing parameters serves as a means to transfer data between different functions within a program. When a function calls another function, it can send information through parameters to the receiving function. Several approaches to parameter passing exist in procedural programming.

  • Pass by value: A technique entails duplicating the parameter's value into the function. While altering the parameter within the function, it does not affect the parameter's original value outside the function.
  • Pass by reference: One alternative method entails transferring the memory location of the parameter to the function. Modifying the parameter inside the function directly affects the initial value of the parameter outside the function.
  • Pass by pointer: This approach resembles pass by reference, except that a pointer to the memory location is passed instead of passing the memory address.

Parameter passing implementation in C using functions:

#include <stdio.h>

int sum(int a, int b) {

    return a + b;

}

int difference(int a, int b) {

    return a - b;

}

int main() {

    int x = 12, y = 7;

    printf("Sum of %d and %d is %d\n", x, y, sum(x, y));

    printf("Difference between %d and %d is %d\n", x, y, difference(x, y));

    return 0;

}

Explanation

To illustrate, let us consider an example where we define two functions: sum and difference. Two functions are provided that calculate the addition and subtraction of two whole numbers. They are designed to be self-contained and reusable in other parts of the program or other programs. The primary purpose of the main function is to call upon these additional functions to calculate the total and discrepancy between two whole numbers, ultimately displaying the outcomes on the console. We facilitate better comprehension, maintenance, and debugging by breaking the program into smaller, more manageable components. This exemplifies the fundamental concept of modularity in procedural programming.