Posts

Showing posts with the label C Language

C Language - The Grammar of a Programming Language

Image
1. Language Grammar Human language has a wide variety of grammar , and learning it requires a great deal of time. You need to learn many grammatical elements such as nouns, verbs, tense, and word order. A programming language is a language with the clear purpose of instructing a computer what to do and how to do it. Even with a relatively small number of grammatical elements, it is possible to express meaning and execute actions. Unlike human language, a programming language can be used immediately once you understand a few core grammar rules . 2. C Language Grammar A programming language consists of the following five elements. Variables - store values. Operations - calculate values. Statements - execute content. Control - change the order of execution. Functions - group multiple statements into one. Understanding just these five grammar elements is enough to understand the basic structure of a program. 2.1. Variables A variable is a memory space that store...

C Language – Starting with “Hello, World!”

Image
1. Installing the C Compiler The most widely used compiler for developing C programs in a Linux environment is GCC (GNU Compiler Collection). While it can be installed individually, it is more efficient to install it via the build-essential package, which includes a collection of essential development tools. $ sudo apt update $ sudo apt install -y build-essential $ gcc --version gcc ... $ make --version GNU Make ... GCC (GNU Compiler Collection) : The standard C compiler in Linux environments. build-essential : A package that installs essential development tools at once, including GCC, g++ (C++ compiler), make (build automation tool), and libc6-dev (standard libraries and headers). 2. The First Program Since the example of printing “Hello, world!” was introduced in the 1978 book The C Programming Language [1] , this phrase has been widely used as the most basic introductory example in programming textbooks across almost all programming la...