Computer Science

C Programming Language

The C programming language is a widely used and influential language in computer science. It was developed for system programming and has a simple and efficient structure. Known for its portability and flexibility, C has been used to create a wide range of software applications, operating systems, and embedded systems.

Written by Perlego with AI-assistance

10 Key excerpts on "C Programming Language"

  • Book cover image for: Low-Level Programming
    eBook - PDF

    Low-Level Programming

    C, Assembly, and Program Execution on Intel® 64 Architecture

    • Igor Zhirkov(Author)
    • 2017(Publication Date)
    • Apress
      (Publisher)
    PART II The C Programming Language 129 © Igor Zhirkov 2017 I. Zhirkov, Low-Level Programming , DOI 10.1007/978-1-4842-2403-8_8 CHAPTER 8 Basics In this chapter we are going to start exploring another language called C. It is a low-level language with quite minimal abstractions over assembly. At the same time it is expressive enough so we could illustrate some very general concepts and ideas applicable to all programming languages (such as type system or polymorphism). C provides almost no abstraction over memory, so the memory management task is the programmer’s responsibility. Unlike in higher-level languages, such as C# or Java, the programmer must allocate and free the reserved memory himself, instead of relying on an automated system of garbage collection. C is a portable language, so if you write correctly, your code can often be executed on other architectures after a simple recompilation. The reason is that the model of computation in C is practically the same old von Neumann model, which makes it close to the programming models of most processors. When learning C remember that despite the illusion of being a higher-level language, it does not tolerate errors, nor will the system be kind enough to always notify you about things in your program that were broken. An error can show itself much later, on another input, in a completely irrelevant part of the program. ■ Language standard described The very important document about the language is the C language standard. You can acquire a PDF file of the standard draft online for free [ 7 ]. This document is just as important for us as the Intel Software Developer’s Manual [ 15 ]. 8.1 Introduction Before we start, we need to state several important points. • C is always case sensitive . • C does not care about spacing as long as the parser can separate lexemes from one another. The programs shown in Listing 8-1 and Listing 8-2 are equivalent.
  • Book cover image for: Handbook of Computer Programming and Hardware Description Languages
    A programming language provides a structured mechanism for defining pieces of data, and the operations or transformations that may be carried out automatically on that data. A programmer uses the abstractions present in the language to represent the concepts involved in a computation. These concepts are represented as a collection of the simplest elements available (called primitives). Programming is the process by which programmers combine these primitives to compose new programs, or adapt existing ones to new uses or a changing environment. Programs for a computer might be executed in a batch process without human interaction, or a user might type commands in an interactive session of an interpreter. In this case the commands are simply programs, whose execution is chained together. When a language is used to give commands to a software application (such as a shell) it is called a scripting language. Measuring language usage It is difficult to determine which programming languages are most widely used, and what usage means varies by context. One language may occupy the greater number of programmer hours, a different one have more lines of code, and a third utilize the most CPU time. Some languages are very popular for particular kinds of applications. For example, COBOL is still strong in the corporate data center, often on large mainframes; FORTRAN in engineering applications; C in embedded applications and operating systems; and other languages are regularly used to write many different kinds of applications.
  • Book cover image for: Computer Programming Languages
    A programming language provides a structured mechanism for defining pieces of data, and the operations or transformations that may be carried out automatically on that data. A programmer uses the abstractions present in the language to represent the concepts involved in a computation. These concepts are represented as a collection of the simplest elements available (called primitives). Programming is the process by which pro-grammers combine these primitives to compose new programs, or adapt existing ones to new uses or a changing environment. Programs for a computer might be executed in a batch process without human interaction, or a user might type commands in an interactive session of an interpreter. In this case the commands are simply programs, whose execution is chained together. When a language is used to give commands to a software application (such as a shell) it is called a scripting language. Measuring language usage It is difficult to determine which programming languages are most widely used, and what usage means varies by context. One language may occupy the greater number of pro-grammer hours, a different one have more lines of code, and a third utilize the most CPU time. Some languages are very popular for particular kinds of applications. For example, COBOL is still strong in the corporate data center, often on large mainframes; FORTRAN in engineering applications; C in embedded applications and operating systems; and other languages are regularly used to write many different kinds of applications.
  • Book cover image for: Important Concepts and Tools in Computer Programming
    ________________________ WORLD TECHNOLOGIES ________________________ Chapter 2 Programming Language A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human communication. Many programming languages have some form of written specification of their syntax (form) and semantics (meaning). Some languages are defined by a specification docu-ment. For example, the C Programming Language is specified by an ISO Standard. Other languages, such as Perl, have a dominant implementation that is used as a reference. The earliest programming languages predate the invention of the computer, and were used to direct the behavior of machines such as Jacquard looms and player pianos. Thousands of different programming languages have been created, mainly in the computer field, with many more being created every year. Most programming languages describe computation in an imperative style, i.e., as a sequence of commands, although some languages, such as those that support functional programming or logic program-ming, use alternative forms of description. Definitions A programming language is a notation for writing programs, which are specifications of a computation or algorithm. Some, but not all, authors restrict the term programming language to those languages that can express all possible algorithms. Traits often considered important for what constitutes a programming language include: • Function and target: A computer programming language is a language used to write computer programs, which involve a computer performing some kind of computation or algorithm and possibly control external devices such as printers, disk drives, robots, and so on.
  • Book cover image for: Introduction to Computer Programming, An
    Traits often consi-dered important for what constitutes a programming language include: • Function and target: A computer programming language is a language used to write computer programs, which involve a computer performing some kind of computation or algorithm and possibly control external devices such as printers, disk drives, robots, and so on. For example PostScript programs are frequently created by another program to control a computer printer or display. More generally, a programming language may describe computation on some, possibly abstract, machine. It is generally accepted that a complete specification for a pro-gramming language includes a description, possibly idealized, of a machine or ________________________ WORLD TECHNOLOGIES ________________________ processor for that language. In most practical contexts, a programming language involves a computer; consequently programming languages are usually defined and studied this way. Programming languages differ from natural languages in that natural languages are only used for interaction between people, while programming languages also allow humans to communicate instructions to mac-hines. • Abstractions: Programming languages usually contain abstractions for defining and manipulating data structures or controlling the flow of execution. The pra-ctical necessity that a programming language support adequate abstractions is expressed by the abstraction principle; this principle is sometimes formulated as recommendation to the programmer to make proper use of such abstractions. • Expressive power: The theory of computation classifies languages by the computations they are capable of expressing. All Turing complete languages can implement the same set of algorithms. ANSI/ISO SQL and Charity are examples of languages that are not Turing complete, yet often called programming lan-guages. Markup languages like XML, HTML or troff, which define structured data, are not generally considered programming languages.
  • Book cover image for: Mathematical Objects in C++
    eBook - PDF

    Mathematical Objects in C++

    Computational Tools in A Unified Object-Oriented Approach

    • Yair Shapira(Author)
    • 2009(Publication Date)
    • CRC Press
      (Publisher)
    The algorithm must therefore be written in a formal, unambiguous context-free language: a programming language. Actually, the computer understands only a very explicit programming lan-guage, which tells it very specifically what datum to fetch from the memory, what arithmetic operation to perform on it, and where exactly to store the result. This is called the low-level (or machine) language. Writing in such a tedious manner would be quite impractical even for the best of programmers. Fortunately, the programmer doesn’t have to write his/her program in the machine language, but rather in a high-level programming language, such as C. The high-level programming language is much easier to use. It uses certain words from English, called keywords or reserved words, to refer to common programming tools such as logical conditions, loops, etc. Furthermore, it uses certain characters to denote arithmetic and logical Boolean operations. Once the high-level code is complete, it is translated to machine language by the compiler. The compiler is a software that can be applied to a code that has been written properly in a high-level programming language, to produce the required machine-language code executable by the computer. For example, the C compiler can be applied to a well-written C code to produce the final machine code ready to be executed (run) on the computer. The stage in which the compiler translates the high-level code written by the programmer into the machine language executable by the computer is called compilation time. The next stage, in which this translated program is actually executed by the computer, is called run time. Variables (or memory cells) that are unspecified in compilation time and are assigned meaningful values only in run time are called dynamic variables. 13.3 The Code Segments in this Book The code segments in this book are fully debugged and tested.
  • Book cover image for: C++ Programming
    eBook - PDF

    C++ Programming

    Program Design Including Data Structures

    © HunThomas/Shutterstock.com An Overview of Computers and Programming Languages IN THIS CHAPTER, YOU WILL: 1. Learn about different types of computers 2. Explore the hardware and software components of a computer system 3. Learn about the language of a computer 4. Learn about the evolution of programming languages 5. Examine high-level programming languages 6. Discover what a compiler is and what it does 7. Examine a C 11 program 8. Explore how a C 11 program is processed 9. Learn what an algorithm is and explore problem-solving techniques 10. Become aware of structured-design and object-oriented design programming methodologies 11. Become aware of ANSI/ISO Standard C 11 , C 11 11, C 11 14 1 CHAPTER Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-300 2 | Chapter 1: An Overview of Computers and Programming Languages Introduction Terms such as “the Internet,” which were unfamiliar just 25 years ago are now com-mon. Students in elementary school regularly “surf” the Internet and use computers to design and implement their classroom projects. Many people use the Internet to look for information and to communicate with others. This is all made possible by the use of various software, also known as computer programs. Without software, a computer cannot work. Software is developed by using programming languages. C 11 is one of the programming languages, which is well suited for developing soft-ware to accomplish specific tasks. The main objective of this book is to help you learn C 11 programming language to write programs. Before you begin programming, it is useful to understand some of the basic terminology and different components of a computer. We begin with an overview of the history of computers. A Brief Overview of the History of Computers The first device known to carry out calculations was the abacus.
  • Book cover image for: C++ Programming
    eBook - PDF

    C++ Programming

    From Problem Analysis to Program Design

    © HunThomas/Shutterstock.com An Overview of Computers and Programming Languages IN THIS CHAPTER, YOU WILL: 1. Learn about different types of computers 2. Explore the hardware and software components of a computer system 3. Learn about the language of a computer 4. Learn about the evolution of programming languages 5. Examine high-level programming languages 6. Discover what a compiler is and what it does 7. Examine a C11 program 8. Explore how a C11 program is processed 9. Learn what an algorithm is and explore problem-solving techniques 10. Become aware of structured-design and object-oriented design programming methodologies 11. Become aware of ANSI/ISO Standard C11, C1111, C1114 1 CHAPTER Copyright 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. 2 | Chapter 1: An Overview of Computers and Programming Languages Introduction Terms such as “the Internet,” which were unfamiliar just 25 years ago are now com- mon. Students in elementary school regularly “surf” the Internet and use computers to design and implement their classroom projects. Many people use the Internet to look for information and to communicate with others. This is all made possible by the use of various software, also known as computer programs. Without software, a computer cannot work. Software is developed by using programming languages. C11 is one of the programming languages, which is well suited for developing soft- ware to accomplish specific tasks. The main objective of this book is to help you learn C11 programming language to write programs.
  • Book cover image for: You Can Program in C++
    eBook - PDF

    You Can Program in C++

    A Programmer's Introduction

    • Francis Glassborow(Author)
    • 2006(Publication Date)
    • Wiley
      (Publisher)
    Usually the result of a successful compilation of C source code with a C++ compiler will be a program that behaves exactly like the one produced by a C compiler. However, that is not always true. In the early 1980s, Bjarne Stroustrup designed an extension to C that he called ‘C with classes’. If you are interested in the history of how that personal tool grew up to become the most widely used programming language in the world and one that has fired the imaginations of many people you will have to look elsewhere. (A good place to start would be with The Design and Evolution of C++ [Stroustrup 1994].) This book is about programming in C++ as the ISO/IEC 14882:2003 Standard defines it, that is, Standard C++ as it was specified in 2003 (which is the first official standard, with various corrections that were made between 1998 and 2003). What is in C++ C++ is one of the most widely used programming languages in the world. It is also one of the largest programming languages ever designed. Bjarne Stroustrup specified that one of the design criteria of the language is that there should be no room for a lower-level language between C++ and native machine code. Very few programmers ever use C++’s lowest level, and many do not even know that it has an asm keyword, which allows support for writing code in assembler. The incorporation of C into C++ was an important design decision. On the positive side, it made it easy for C programmers to transfer to C++. Having made the transfer they could, at least in theory, incrementally 2 OVERVIEW OF C++ add to their C++ skills and understanding. On the negative side, it has tied C++ to a number of features of C’s design that experience has shown to be, at best, problematical. It has also caused problems to many who have moved from C to C++, because they have made the transition from a C to a C++ compiler without actually making the mental transition from C to C++.
  • Book cover image for: C++ for Engineers and Scientists
    This object orientation, which was ideal for graphical screen objects such as rectangles, circles, and windows, was combined with existing C features to form the C++ language. Therefore, C++ retained the extensive structured and procedural capabilities of C but added its object orienta-tion to become a true general-purpose programming language. C++ can be used for everything from simple, interactive programs to sophisticated, complex engineering and scientific pro-grams, within the context of a truly object-oriented structure. Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. 35 Chapter 1 A Closer Look: Software, Hardware, and Computer Storage Computer Hardware All computers, from large supercomputers to desktop PCs, must be capable of at least the following: • Accepting input • Displaying output • Storing information in a logical, consistent format (traditionally binary) • Performing arithmetic and logic operations on input or stored data • Monitoring, controlling, and directing the computer’s overall operation and sequencing Figure 1.15 illustrates the computer components that support these capabilities and collectively form a computer’s hardware . Arithmetic and logic unit (ALU) Output Input Memory Secondary storage Control Central processing unit (CPU) Figure 1.15 Basic hardware units of a computer The arithmetic and logic unit (ALU) performs all arithmetic and logic functions, such as addition and subtraction. The control unit directs and monitors the computer’s overall operation.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.