TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

C Tutorials

C Variables

Overview

In this tutorial, we will learn about C Variables. Variable names are names that refer to computer memory locations. ( RAM: Random Access Memory). We can use simple human-readable variable names to store and access the program data. Programmers do not need to remember or use the actual memory address in order to store or retrieve data.

C Variables

We can store data in the variables and access them to perform calculations in the C program. Before using the variable in the C program we need to declare the variable.

Variable declaration

When you define a variable in a C program, we must tell the C compiler the variable name and what kind of data or data type of the variable it will hold.

For example integer, float, double, char, bool, etc.

Declare Single Variable

The general syntax of the variable declaration in C is as follows:

<data_type> <variable_name>;

 

 

C Variable Declaration

Examples

int number;

In this example, we have declared an integer variable called number. The variable can store whole numbers.

C Variables

Let’s declare another variable. In this example, we have declared interestRate variable of double datatype.

double interestRate;

double area;

Declare Multiple Variables

We can also declare multiple variables of the same data type using a single statement:

double length, width, area;

—

C Tutorials

C Tutorials on this website can be found at:

https://www.testingdocs.com/c-language-tutorial/

Related Posts

C Language Characteristics

C Tutorials /

C Language Characteristics

C Source Code .c File

C Tutorials /

C Program Files & Formats

GNU Compiler Collection GCC

C Tutorials /

C Compilers

C Pointers

C Tutorials /

C Pointers

C Tutorials /

C Two-Dimensional Arrays

‹ C Reserved Words› C Programming Environment

Recent Posts

  • Update draw.io on Windows
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com