0% found this document useful (0 votes)
6 views

Programming I - L1

The document discusses various programming languages and frameworks including C, C++, PHP, .NET, HTML, Flutter, ReactJS, React Native, Vue.js, and Node.js. It provides a brief history of C, explaining that Dennis Ritchie created it in 1972 at Bell Labs to program Unix computers. It also outlines the basic structure and steps of a C program, including #include, main(), printf(), and return 0. Finally, it covers the preprocessing, compilation, assembly, and linking stages required to transform C code into an executable program.

Uploaded by

Your Gamer
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Programming I - L1

The document discusses various programming languages and frameworks including C, C++, PHP, .NET, HTML, Flutter, ReactJS, React Native, Vue.js, and Node.js. It provides a brief history of C, explaining that Dennis Ritchie created it in 1972 at Bell Labs to program Unix computers. It also outlines the basic structure and steps of a C program, including #include, main(), printf(), and return 0. Finally, it covers the preprocessing, compilation, assembly, and linking stages required to transform C code into an executable program.

Uploaded by

Your Gamer
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Programming I (using C)

The System
The Flow
Programming language
Why Programming
 C-
It is the basic, middle-level programming language having a simple set of keywords that are used to develop moderate-level applications.
C is the best means to step into the programming world, especially for beginners.
 C++-
Foremost programming language taught in the education institutes. An extension of the C language, that allows developers to code for
middle-level applications such as- graphics, office applications, games, and video editors.
 PHP–
PHP Development is a popular general-purpose programming language that is particularly suited to web development. It is quite fast,
easy to learn, flexible and pragmatic additionally PHP controls everything from your blog to the utmost popular websites in the world. It
can be used to develop an application to create dynamic page content.
 .NET-
It is a free, cross-platform, open-source developer platform used to build several kinds of applications. For developers, the .NET
Framework delivers a broad, wide-ranging and reliable programming language which is used for building applications that have visually
spectacular user experiences and smooth and secure communication. Different applications (for- mobile, desktop, IoT, gaming, web) can
be developed with the help of .Net because it uses several different languages, libraries, editors.
 HTML–
It is the standard markup language used to design documents for a web browser. Through this, developers can easily format text and
images. CSS and JavaScript work as the helping hands for HTML developers.
Programming

 Flutter–
It is an open-source framework developed by Google to craft high-quality native interfaces such as- diverse mobile
applications. The application developed by Flutter gives better performance because there’s no JS bridge.
 ReactJS–
Also named as React.js. It is a JavaScript library used to create user interfaces. Mainly, it is used to develop single-
page applications or web pages. This is an excellent option for fetching quickly changing data.
 React Native–
It is an open-source mobile application framework developed by Facebook after the launch of React. Developers
can easily develop applications for iOS, Web, Android, and UWP by using the React along with the Native
platform.
 Vue.js–
It is an MIT-licensed open-source framework for developing user interfaces. As per the use and need the library and
framework can be scaled up easily. It is well known for its speed.
 Node.js–
It is a cross-platform, open-source, JavaScript run-time environment that executes JavaScript code outside of a
browser. Node has the ability to manage thousands of connections simultaneously with a single server.
C : The journey
 In 1972, Dennis Ritchie was at Bell Labs, where a few years earlier, he and his fellow team
members invented Unix.
 After creating an enduring OS (still in use today), he needed a good way to program those
Unix computers so that they could perform new tasks.
 Few programming languages were available; Fortran, Lisp, Algol, and B were popular but
insufficient for what the Bell Labs researchers wanted to do.
 Demonstrating a trait that would become known as a primary characteristic of
programmers, Dennis Ritchie created his own solution.
 He called it C, and nearly 50 years later, it's still in widespread use.
Structure of C program
First Program
First program

// hello.c
#include <stdio.h>

int main()
{
printf("Hello world\n");
return 0;
}

$ gcc hello.c –o hello

$ ./hello
Hello world
$
Printf() essentials
Compile a C Program
$ gcc [options] [source files] [object files] [-o output file]
$ gcc -Wall -save-temps hello.c --output hello

 Pre-processing: generates <filename>.i


 Compilation: generates <filename>.s
 Assembly: generates <filename>.o
 Linking

Ref: https://www.rapidtables.com/code/linux/gcc.html
gcc options
option description

gcc -c compile source files to object files without linking

gcc -Dname[=value] define a preprocessor macro

gcc -fPIC generate position independent code for shared libraries

gcc -glevel generate debug information to be used by GDB

gcc -Idir add include directory of header files


gcc -llib link with library file
gcc -Ldir look in directory for library files
gcc -o output file write build output to output file

gcc -Olevel optimize for code size and execution time

gcc -shared generate shared object file for shared library

gcc -Uname undefine a preprocessor macro


gcc -w disable all warning messages
gcc -Wall enable all warning messages
gcc -Wextra enable extra warning messages
Pre-processing and Compilation

 Removal of Comments
 Expansion of Macros
 Expansion of the included files.
 Conditional compilation
 For addition program
 Comments are stripped off.
 #include<stdio.h> is missing instead lots of code added. So header files has been expanded and included
in the source file.
Compilation
 compile filename.i and produce an intermediate compiled output file filename.s.
 This file is in assembly level instructions.
Assembly

 filename.s is taken as input and turned into filename.o by assembler.


 This file contain machine level instructions.
 At this phase, only existing code is converted into machine language, the function calls
like printf() are not resolved.
Linking

 Final phase in which all the linking of function calls with their definitions are done.
 Linker knows where all these functions are implemented.
 Linker adds some extra code to the program which is required when the program starts and
ends.
 For example, there is a code which is required for setting up the environment like passing
command line arguments.
 This task can be easily verified by using $size filename.o and $size filename.
Learning C
First Program
Thank You

You might also like