0% found this document useful (0 votes)
13 views16 pages

C Programming Fundamentals Guide

The document discusses computer programming fundamentals including what a computer and program are, computer systems with hardware and software components, programming languages from machine to high level, and an overview of the C language including why it is a good first language and the structure of C programs.

Uploaded by

Ali Akram
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views16 pages

C Programming Fundamentals Guide

The document discusses computer programming fundamentals including what a computer and program are, computer systems with hardware and software components, programming languages from machine to high level, and an overview of the C language including why it is a good first language and the structure of C programs.

Uploaded by

Ali Akram
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

NOTES FOR PROGRAMMING

FUNDAMENTAL
Teacher- [Link]. Yasir Arfat Malkani
Made By: Waseem Qadir (ARTIFICIAL INTELLIGENCE) SU
Computer: Computer is an electronic machine, which accept input data, process it and
produce output results according to the given list of instructions. (i.e Program)

Program: is a list of as sequence of instructions that are given to the computer to solve any
particular problem.

Computer Programming: The Science and art of writing instructions for the computer.
OR The Science and art of writing program.

COMPUTER SYSTEM

Software Hardware

Application System
Programming
Software. Software.
Language.
MS word.
MS Excel OS Utilities
MS PowerPoint. UNIX. Disc Manager
Typing Tuter. LINUX. Antivirus Software
WINDOWS. Drivers
MC OS
ETC
Programming Language

Machine, Assembly
High Level.
Binary
Mov Ax, 5
Forton, Cobol,
11100011 Add Ax, 3 Java,
Python,C#,C
10011101 Assembler
Pascal, B etc
11010111
Compiler, Interpreter

Translater

Assembler Interpreter
Compiler

DEVELOPMENT OF C LANGUAGE
MULTICS ( Multiplexed Information and computing Service ) is a p0werful operating
system and it has some license issues and its very hard the scientist initiate a project that aimed to
make simple, powerful , user-friendly and easy to learn operating system .

UNIX operating system at AT&T Bell lab

Ken Thompson developed B language at AT&T bell lab) USA (1970)

(1972).
UNIX Karnel is converted from assembly to a high level language,(i.e.-C LANGUAGE )

WHY TO LEARN C LANGUAGE AS FIRST PROGRAMMING


LANGUAGE.

= Symple Syntax

= Easy to learn

=Most of modern language ( Such as C++, C#, Java etc ) follow the format of C language.

= Allow system level programming

ROAD MAP TO LEARN A PROGRAMMING LANGUAGE

Step to learn Human Language Step to Learn a Programming language

1) Language Alphabate set. 1) Learn language character set

2) Create words from alphabets.


2) Constant, variables, Keywords or reserved
words.

Create sentences by combining word in proper


order. (I.e Apply grammar). 3) Write indtructions by combining Constants,
Variables and keywords in proper order.

3) Write paragraph and essays.


4) Develop Program / Software.

STRUCTURE OF C PROGRAMS
void main ( ) Int main ( )

{ {

// C instruction // C instruction

} }

FIRST C PROGRAM

void main ( ) C uses Compiler.

{ C is a case sensitive Language which means


it differentiates between small and capital
printf (“HELLOW WORLD”); latters.

} Example: A and a are two different letters


/symbols for
Output is given bellow

HELLOW WORLD
DEPARTMENT OF ARTIFICIAL
INTELLIGENCE
UNIVERSITY OF SINDH

Common questions

Powered by AI

Machine language, composed of binary code, is directly executed by the computer. Assembly language, a step above machine language, uses mnemonic codes for programming, offering slightly improved readability but still requiring an assembler for execution. High-level languages like C further abstract the complexities of machine and assembly languages, providing readability and ease of use without compromising control over hardware. C, specifically, provides system-level programming capabilities while maintaining simplicity, making it suitable for both system software and application development .

In educational settings, having both a compiler and an interpreter helps illustrate the differences in code execution and performance. Compilers, which translate entire programs, offer insights into optimization and efficiency, critical concepts in large-scale software development taught through languages like C. Interpreters, translating code line-by-line, are valuable for immediate code testing and debugging in educational contexts, allowing students to understand execution flow and runtime errors in real-time. This dual approach deepens understanding of programming concepts and prepares students for various development environments .

High-level programming languages, such as C, have significantly contributed to operating systems' development by enhancing their portability, readability, and maintainability. C language, in particular, enabled the conversion of UNIX's kernel from assembly to a high-level language, making the system more accessible and simpler to modify and expand. This shift allowed for more widespread adoption and adaptation of UNIX, showcasing the role of high-level languages in improving the usability of operating systems .

A simple C program consists of several components essential for its execution. For example, consider the program: `void main() { printf("HELLOW WORLD"); }`. "void main()" signifies the main function where execution begins. "printf("HELLOW WORLD");" is a command that outputs text to the screen. Each part serves a specific function: the main function serves as the entry point for execution, and the printf function interacts with output devices. Understanding these components is crucial for developing functional C programs .

C's simple syntax is highly effective in laying a strong foundation for learners, facilitating transitions to other modern languages. The syntax and structural conventions of C are mirrored in many modern languages such as C++, C#, and Java. This mirror effect reduces the learning curve when transitioning to these languages, as the core principles and syntax structures are already familiar to C programmers. Consequently, learning C first equips learners with the necessary skills to easily adapt to more complex programming languages .

Compilers and interpreters are tools used to translate human-readable code into machine code. In C programming, compilers are primarily used. A compiler translates the entire program into machine code before execution, allowing the C program to run efficiently with optimized performance. Interpreters, on the other hand, translate code line-by-line during execution, which can be slower but allows for more dynamic and flexible code execution. The use of a compiler in C reflects the language's design to produce fast, efficient executables .

The primary reasons the C language is recommended as a first programming language include its simple syntax and ease of learning, the format of which is followed by many modern programming languages such as C++, C#, and Java. Additionally, C allows for system-level programming, which is fundamental for understanding how software interacts with hardware, making it a foundational language for learners .

The C language evolved from the need to rewrite UNIX's Kernal in a high-level language. Initially, UNIX was written in assembly language. Ken Thompson developed the B language at AT&T Bell Labs as a precursor. In 1972, C was developed to address the limitations of B, resulting in an easier-to-use, powerful operating system. This transition from B to C allowed UNIX to be easily portable across different machines, and C's simplicity and efficiency made it widely adopted in system programming .

Both human and programming language learning involve understanding fundamental elements and rules. In human language, learners start with alphabets, create words, and form grammatically correct sentences. Similarly, in programming languages like C, learners begin with character sets, utilize constants and variables, and combine them with reserved keywords to create instructions and programs. The significant difference lies in the rules and syntax specific to programming languages, which are stricter to ensure that the computer can process and execute the commands accurately .

In C programming, case sensitivity means that the language distinguishes between uppercase and lowercase letters, which affects identifiers and code readability. For example, the variable names 'Variable', 'variable', and 'VARIABLE' are considered distinct and separate. This feature is important for avoiding naming conflicts and maintaining consistency in code, allowing developers to use varied naming conventions for clarity and organization without overlap, thus enhancing the language's precision in coding .

You might also like