Table of Contents
Format of C language
Semicolon
Case Sensitive
Comments are not required
Sample program
Example
Output
Home Backend Development C++ Explain the format of C language

Explain the format of C language

Sep 06, 2023 pm 08:01 PM
grammar Coding Standards Punctuation c language format

Explain the format of C language

C programming is a general-purpose, procedural, and imperative computer programming language. In C language, we see that the

  • statement ends with a semicolon.
  • C case sensitive
  • Indentation is ignored by the compiler.
  • Strings are placed in double quotes.
  • Library functions are in lowercase.
  • Line breaks are processed by

  • >

Format of C language

The format of C programming language is explained as follows-

Semicolon

Semicolon is very important in C language.

It tells the compiler where one statement ends and the next statement begins.

If we fail to place a semicolon after each statement, you will receive a compilation error.

Case Sensitive

C is a case-sensitive language. Although int compiles, "Int", "INT" or any other variant does not work in C.

All C keywords are lowercase.

Comments are not required

Although comments are not important, it is a good practice to add comments at the beginning of a program that indicate the purpose of the program, such as the author and the person who wrote it date.

Sample program

The following is a C program that uses the C format method to calculate the circumference of a circle -

The formula for the circumference of a circle = 2*PI*R. p>

Among them, R is the radius of the circle, PI is a constant, and the value is PI3.415.

Example

#include<stdio.h> //library function are lower case
#include<conio.h>
#define PI 3.1415
main ( ){
   float c, r; //statements are terminated with semicolon
   printf ("enter radius of circle"); //strings are placed in double
   quotes
   scanf ("%f", &r);
   c = 2 * PI * r;
   printf ("Circumference = %f", c);
   getch ( );
}
Copy after login

Output

When the above program is executed, the following results are produced -

Enter radius of circle 1
Circumference=6.2830
Copy after login

The above is the detailed content of Explain the format of C language. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Sharing tips on dealing with the problem of Chinese garbled characters imported into Oracle Sharing tips on dealing with the problem of Chinese garbled characters imported into Oracle Mar 09, 2024 pm 10:03 PM

Tips for dealing with Chinese garbled characters imported into Oracle. During the process of data import using Oracle database, we often encounter garbled Chinese data. This may be due to character set mismatch, data source encoding issues, or database configuration errors. In order to solve this problem, this article will share some tips for dealing with the problem of Chinese garbled characters imported into Oracle, so that everyone can smoothly import Chinese data in actual operations. 1. Check the database character set. Before dealing with the Chinese garbled problem, you first need to check

How to quickly turn your Python code into an API How to quickly turn your Python code into an API Apr 14, 2023 pm 06:28 PM

When it comes to API development, you may think of DjangoRESTFramework, Flask, and FastAPI. Yes, they can be used to write APIs. However, the framework shared today allows you to convert existing functions into APIs faster. It is Sanic . Introduction to Sanic Sanic[1] is a Python3.7+ web server and web framework designed to improve performance. It allows the use of the async/await syntax added in Python 3.5, which can effectively avoid blocking and improve response speed. Sanic is committed to providing a simple and fast way to create and launch

What are the syntax and structure characteristics of lambda expressions? What are the syntax and structure characteristics of lambda expressions? Apr 25, 2024 pm 01:12 PM

Lambda expression is an anonymous function without a name, and its syntax is: (parameter_list)->expression. They feature anonymity, diversity, currying, and closure. In practical applications, Lambda expressions can be used to define functions concisely, such as the summation function sum_lambda=lambdax,y:x+y, and apply the map() function to the list to perform the summation operation.

New type alias syntax in PHP8.0 New type alias syntax in PHP8.0 May 14, 2023 pm 02:21 PM

With the release of PHP 8.0, a new type alias syntax has been added, making it easier to use custom types. In this article, we'll take a closer look at this new syntax and its impact on developers. What is a type alias? In PHP, a type alias is essentially a variable that references the name of another type. This variable can be used like any other type and declared anywhere in the code. The main function of this syntax is to define custom aliases for commonly used types, making the code easier to read and understand.

Parent class calling syntax in PHP8.0 Parent class calling syntax in PHP8.0 May 14, 2023 pm 01:00 PM

PHP is a server-side scripting language widely used in Web development, and PHP8.0 version introduces a new parent class calling syntax to make object-oriented programming more convenient and concise. In PHP, we can create a parent class and one or more subclasses through inheritance. Subclasses can inherit the properties and methods of the parent class, and can modify or extend their functionality by overriding the methods of the parent class. In ordinary PHP inheritance, if we want to call the method of the parent class in the subclass, we need to use the parent keyword to refer to the parent

The connection and difference between Go language and JS The connection and difference between Go language and JS Mar 29, 2024 am 11:15 AM

The connection and difference between Go language and JS Go language (also known as Golang) and JavaScript (JS) are currently popular programming languages. They are related in some aspects and have obvious differences in other aspects. This article will explore the connections and differences between the Go language and JavaScript, and provide specific code examples to help readers better understand these two programming languages. Connection: Both Go language and JavaScript are cross-platform and can run on different operating systems.

Understand the basic units of C language Understand the basic units of C language Mar 21, 2024 pm 05:36 PM

C language is a programming language widely used in system programming and application software development. Its basic units mainly include variables, data types, operators, etc. When learning and understanding the basics of C language, mastering these basic units is particularly critical. This article will introduce the basic units of C language through specific code examples to help readers better understand. First, let's take a look at variables in C language. Variables are used to store data in C language. Each variable has its own data type and can store different types of data, such as integers and floating point.

What is the difference between C and C++? What is the difference between C and C++? Aug 29, 2023 pm 11:53 PM

The C programming language C is a general-purpose, high-level language originally developed by Dennis M. Ritchie at Bell Labs to develop the UNIX operating system. C was first implemented in 1972 on the DECPDP-11 computer. In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available description of C, now known as the K&R standard. The UNIX operating system, C compiler, and almost all UNIX applications are written in C. For various reasons, C language has now become a widely used professional language. It is a structured language that is easy to learn, it produces efficient programs, it can handle low-level activities, and it can run on a variety of computers.

See all articles