answersLogoWhite

0

Store value in variable c plus plus?

User Avatar

Anonymous

11y ago
Updated: 8/18/2019

#include<iostream>

int main()

{

int var=42; // store the value 42 in a variable named var.

return(0);

}

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

What machine instruction is used to assign a value to a variable in c plus plus?

MOVE, STORE, LOAD, or something similar, CPU-dependent.


What are variables in C?

variable is must start with letter or ( _ ) under score ex : int a; means a is a variable we can store value on it


What is B plus B plus B plus C plus C plus C?

It is impossible to give any decimal/numeric value if we are not given the values of at least one variable, so the answer is B + B + B + C + C + C.


What is the use of variables in c language?

Variable is of any Data Type and Data Type can be defined as a type of value that a Variable will hold.............means which type of value you want to store, eg: fractional value (3.5454), whole value (3,76,3,67), character value (a,v,c,f,b,z) etc.......... So The Use the Variable is to store a value of any kind (some mentioned above)


What is the difference between instantiation and initialization in C plus plus?

Instantiation is creating the instance of the variable/object . While Initialization is to provide the variable with some value. int i; // i is an instance of an integer i=10; //initialised with the value 10


What is the meaning of star d in c plus plus programming?

If d is a pointer variable, then *d is the value stored in the memory address pointed to by d.


What does a constant do in c plus plus?

A constant is a variable that does not change. The correct term is constant variable.


How many values can store a variable at a time?

The number of values a variable can store at a time depends on the data type of the variable. For example, a variable of type int (integer) in many programming languages can store a single integer value at a time. Similarly, a variable of type float (floating-point number) can store a single floating-point value. Other data types like arrays or lists can store multiple values at a time. The capacity of a variable to store values is determined by its data type and memory allocation.


What do you understand by constant and variable in c plus plus program?

A variable is any named value of a specified type that can hold any value of that type, and that can change that value at any time while the name is in scope. A constant is exactly the same as a variable except that its value must be set at the point of instantiation and the given value cannot be altered while the name remains in scope. In other words, a variable is a value that may vary while a constant is a value that always remains the same.


What is syntax in c plus plus for declaring a variable?

type variable {[optional array size]} {= optional initializer};


Is the word main an illegal variable name in C PLUS PLUS?

I can tell you that it is not an illegal variable name in C. I do not currently have a C++ compiler installed, but I would assume that it would also be valid in C++.


What is variable in c plus plus programming?

You declare a variable by first defining its data type and then its name followed by a semi-colon. Here is an example: int variable; The example above declares an uninitialized integer variable. You can initialize the variable by giving it a value such as "int variable = 1;". It is important to initialize your variables, because you can get errors when executing your program that the variable does not have a value or is uninitialized. Variables that are uninitialized have whatever garbage value happens to be when the program is executed. Here are all of the data types that a variable can be: *int - integer value *char - character value *bool - boolean value