Lecture 01 Introduction To Programming
Lecture 01 Introduction To Programming
Lecture 01 Introduction To Programming
Programming with C
ICT 012
• IDE:Dev-C++
• Internet Resources:
https://www.w3schools.com/c/index.php
About the Course -Assessment
Assessment
• Assignment - 15%
• In terms of ease of use and capabilities, each generation is an improvement over its
predecessors.
① Machine language
② Assembly language
③ High-level language
Machine language
• Each type of computer has its own machine language. In the early days of
computing, programmers had rudimentary systems for combining numbers
to represent instructions such as add and compare.
Example of Assembly
language codes
mnemonic
Assembly language…
• Assemblers
The assemblers are used to translate the assembly language into machine language.
High-level language
• The first widespread use of high-level languages in the early 1960s transformed
programming into something quite different from what it had been.
• As a result, a programmer could accomplish more with less effort, and programs
could now direct much more complex tasks.
High-level language…
• This translator is usually a compiler. There are many compilers for each
language and one for each type of computer.
High-level language…
• Easy to learn
• Structured language
• Operating Systems
• Language Compilers
• Assemblers
• Text Editors
• Print Spoolers
• Network Drivers
• Modern Programs
• Databases
C Programs
• A C program can vary from 3 lines to millions of lines and it should be written
into one or more text files with extension ".c";
• For example, hello.c. You can use "Notepad++”, or any other text editor to
write your C program into a file.
• But for this course we are going to use an Integrated Development Environment
(IDE) called Dev-C++.
What Is An IDE?
• Code editor: Designed for writing and editing source code, these editors are distinguished from text
editors because work to either simplify or enhance the process of writing and editing of code for
developers
• Compiler: Compilers transform source code that is written in a human readable/writable language in a
form that computers can execute.
• Debugger: Debuggers are used during testing and can help developers debug their application programs.
• Build automation tools: These can help automate developer tasks that are more common to save time.
C - Program Structure
• Preprocessor Commands
• Functions
• Variables
• Comments
Hello World
Program • Let us look at a simple code that would print the words
"Hello World“
#include <stdio.h>
int main() {
Output:
/* my first program in C */
Hello, World!
printf("Hello, World! \n");
return 0;
}
Parts of the • #include <stdio.h> is a preprocessor
command, which tells a C compiler to include
hello world <stdio.h> file before going to actual
program compilation.
• If there are no errors in your code, the command prompt will take you to the
next line and would generate a.out executable file.
• You will see the output "Hello World" printed on the screen.
How to create C Program Using Dev-C++ (IDE)
• Launch Dev-C++.
• Select "New" and then "Project..." or use the keyboard shortcut "Ctrl+Shift+N."
• In the "New Project" dialog, choose "Console Application" and click "OK."
• Enter the project title and choose a location to save your project. Click "Save."
How to create C Program Using Dev-C++ (IDE)
After creating the project, Dev-C++ will open a new source file. You can start writing your C code
here. By default, it creates a simple "Hello, World!" program.
How to create C Program Using Dev-C++ (IDE)
Save your source file by clicking "File" and then "Save" or using the
keyboard shortcut "Ctrl+S." Choose the location where you want to save it
and provide a meaningful filename with the ".c" extension (e.g.,
myprogram.c).
How to create C Program Using Dev-C++ (IDE)
• Select "Compile."
• Dev-C++ will compile your code. If there are no errors, you'll see "0
errors" in the Output window at the bottom.
How to create C Program Using Dev-C++ (IDE)
• Select "Run."
• You'll see the output of your program in the console window that opens.
Thank You