What is a variable?
Experience Level: Junior
Tags: C#
Answer
A varialbe is a container for holding a value of a specific type.
If you want to sum two numbers, you might use 3 variables. 2 variables for holding two numbers that are to be added and one variable for storing the result.
In the following example, the number 4 is stored to the variable a. Number 6 is stored to the variable b. Then the values of these two variables are added and the result is stored to the variable c, so the variable c now holds value 10;
var a = 4;
var b = 6;
var c = a + b;
Remembner: Before you can use a variable you have to declare it.
Related C# job interview questions
How can you assign a value to a variable in C#?
C# JuniorWhat is a 'var' keyword in C# good for?
C# JuniorWhat is the 'new' keyword used for in C#?
C# JuniorHow can you assign a value to a property in C#?
C# JuniorHow can you recognize a property in C#?
C# Junior
Chat
Oh, the operator is not available. Leave us your comments. We will answer all your questions as soon as possible.
Anonymous
Καλησπέρα.
Καλησπέρα.
Anonymous
the infinteis -3/15 so 1triition / infinet
the infinteis -3/15 so 1triition / infinet
Anonymous
e
e
Anonymous
<a href="https://inspirum.pl "
<a href="https://inspirum.pl "
Anonymous
[url]https://inspirum.pl[/url]
[url]https://inspirum.pl[/url]
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e