C Programming Language - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

C Programming Language

Description:

Developed by Bjourne Stroustrup in 1983 as enhancement from C (fast and reliable) ... parameter from being passed into a function to be overwritten by buffer overrun. ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 22
Provided by: shahibull
Category:

less

Transcript and Presenter's Notes

Title: C Programming Language


1
C Programming Language
  • Presented by Shahibullah Ithnin
  • WGA 050035

2
Part I Introduction of C
  • Developed by Bjourne Stroustrup in 1983 as
    enhancement from C (fast and reliable)
  • Design goal for programmer to create a good
    program which be produced easier and more
    pleasant.
  • Application area multimedia (Adobe), OS
    (Apple), animation software (Maya), browser
    (Mozilla) handphone (Nokia) etc.

3
Part I Introduction of C (cont)
  • Programming Paradigm
  • Procedural instruction telling computer
    step-by-step what to do like ifelse and
    dowhile.
  • Modular large program can be break into small
    modules for easily testing and run like
    functions
  • Object-oriented properties, operations and
    behaviors in common from previous project can be
    apply to new project with inheritance.
  • Generic reused data type in a variety of
    situations with polymorphism.

4
Part I Introduction of C (cont)
  • Features
  • Operators performs Boolean arithmetic on values
    and strings of text.
  • Preprocessor process input data to produce
    output used as next input to another program.
  • Template can be used to produce conditional
    compilation. Templates are a tool for static
    polymorphism and generic programming.
  • Objects object-oriented features such as
    classes, abstraction, encapsulation, inheritance,
    polymorphism.

5
Part I Introduction of C (cont)
  • Claims for security, portability, efficiency and
    extensibility/maintainability
  • Security with poor coding practice, its easy
    to write data outside the allocated buffer in
    memory. When the vulnerability is exploited by
    bugs makes the program crashed (buffer overrun).
  • Portability easy to compile with different
    compiler and platform due to language standard,
    thus able to swift from one project to another.

6
Part I Introduction of C (cont)
  • Claims for security, portability, efficiency and
    extensibility/maintainability (cont )
  • Efficiency by choosing right compiler with the
    support of OOP principal makes it run faster,
    less space and processor power consumption.
  • Extensibility/maintainability with inheritance
    and polymorphism, its easy to maintain the
    development of new codes which readily to be
    modified for new requirements.

7
Part I Introduction of C (cont)
  • The compilation model
  • There are many compilers for C around and gcc
    is the most popular and available for many
    different platforms. But for Microsoft Windows
    users, they would be familiar with the Borland
    bcc compiler.
  • Next slide will show the general descriptions for
    the gcc C compilers.

8
Part I Introduction of C (cont)
Figure 1 gcc compilation model for C
9
Part II Description of Language
  • Why C, C and Java
  • C predecessor of C and adding more advance
    features to develop C class, operator
    overloading and many more.
  • Java developed from C by simplifying and
    removing some features such as pointers, operator
    overloading, enum and many more.
  • Comparison included
  • Scalar data (enumerations)
  • Composite object (pointers)
  • Structured object (arrays)
  • Abstract data (classes)

10
Scalar Data Object enum
  • Scalar data object enum is used to assign a
    static value for variables in C
  • The comparison is
  • C uses define
  • C uses enum
  • Java uses class

11
Composite Object pointers
  • A pointer is a variable which contains the
    address in memory of another variable in C and
    C
  • The difference is
  • C uses malloc ()
  • C uses new
  • Java has no pointer

12
Structured Object array
  • Arrays is used to store several to many that are
    of the same type and logically related to each
    other.
  • Both C, C and Java share the same syntax to
    create arrays

13
Structured Object array (cont )
14
Abstract Data Type classes
  • Classes provide access to members of a class with
    public, private and protected.
  • The difference is
  • C does not have class.
  • C declare the protection level
  • public
  • void setValues ()
  • int displayArea ()
  • Java declares the protection level
  • public void setLength()
  • public int displayArea()

15
Abstract Data Type classes (cont )
16
Abstract Data Type classes (cont )
17
Part III Final Evaluation
  • Basic to agree/disagree with any claim for
    security, portability, efficiency,
    maintainability
  • Security /GS compiler generates code that
    detects buffer overrun during run-time and close
    the vulnerability without affecting performance.
    It also protects vulnerable parameter from being
    passed into a function to be overwritten by
    buffer overrun. Thus, it will enhance the code
    security and robustness.

18
Part III Final Evaluation (cont )
  • Efficiency object-oriented principles and the
    choosing the right compiler enable program to
    perform better.
  • Portability however, the program might perform
    inefficient or slow when running in different
    platform due to some problems such as
    incompatible compiler version.
  • Maintainability to solve this, the code should
    always be modifiable to fit into the different
    requirements and environments.
  • Sometimes, when editing the code for enhancement
    without proper testing could inject bugs (poor
    coding practice)
  • Thus, the expenses of maintainability to fulfill
    new requirements always cost for more budget.
  • Conclusion, if the goal is to have efficient
    programs, we should compromise on the
    portability. Otherwise, maintainability always
    comes first with high cost to support the
    portability.

19
Part III Final Evaluation (cont )
  • Difficulty in C How to use pointer and
    reference?

20
Part III Final Evaluation (cont )
  • Programming environment rating
  • Preferred compiler gcc (good)
  • Easy to do detection and reporting on some
    obvious error such as misspelled keywords or
    omitted semi-colon.
  • Preferred language in future
  • It has useful features to write portable,
    efficient and easy-to-use libraries.
  • For instance, in developing a complex system, a
    programmer might use variety of popular scripting
    language for writing interfaces, SQL for database
    queries, Java for network programming or
    Postscript to communicate with a printer.
  • In these scenarios, C is able to well-suited
    tying them to work together. It has features
    specifically for calling libraries written in
    other languages to make them easy to be connected
    with C.

21
Main Reference
  • www.wikipedia.com
  • www.answer.com
  • www.cplusplus.com
  • http//java.sun.com
  • www.thescripts.com
Write a Comment
User Comments (0)
About PowerShow.com