ELEVATE YOUR BUSINESS WITH

Limitless customization options & Elementor compatibility let anyone create a beautiful website with Valiance.

Variables in C

SELECT * FROM `itio_tutorial_master` WHERE `tutorial_menu`='28' AND `tutorial_submenu`='1638' AND `tutorial_status`=1 LIMIT 1

Variables in C

? Variables in C

A variable is a name that stores a value — like a container in memory you can use and update.


? Syntax

c

type variableName = value;

Example:

c

Data TypeDescriptionExample
intIntegerint x = 10;
floatFloating point numberfloat pi = 3.14;
charSingle characterchar grade = 'A';
doubleDouble precision floatdouble d = 9.81;
char[]String (array of chars)char name[] = "Alice";


? Declaring Multiple Variables

c

int a = 5, b = 10, c;


? Rules for Naming Variables

  • Must start with a letter (or _)

  • Can contain letters, numbers, and underscores

  • Case-sensitive (age ? Age)

  • Avoid keywords (int, return, etc.)


? Example Program

c

#include <stdio.h>int main() { int age = 20; float gpa = 3.75; char grade = 'A'; printf("Age: %d\n", age); printf("GPA: %.2f\n", gpa); printf("Grade: %c\n", grade); return 0;}


? Tip:

Always initialize your variables — C doesn't automatically set them to zero!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql