A process of setting or re-setting the value stored in the storage location(s) denoted by a variable name.
Questions tagged [variable-assignment]
4336 questions
1
vote
1 answer
Final variable of `enum` type does not produce error when perform an assignment
So I was cleaning my code and adding final keywords to whichever places possible, one of those place happen to be an uninitialized variable of enum type.
The variable is not initialized because its value needs to be determined by a switch statement.…

Quan Bui
- 175
- 1
- 13
1
vote
2 answers
Inserting parameters to SQL query in Oracle SQL
In the following query between date time columns are repeated in multiple places and I need to replace them with two variables named start_date and end_date I tried multiple methods and had no luck. Please answer with a runnable query if you can.…

Inod Umayanga
- 114
- 1
- 7
1
vote
3 answers
Is this a correct way to define array of pointers to array?
Is this a correct way to define array of pointers to array in C programming language?
int* ptr[2];
int n1[5] = { 2,3,4,5,6 };
int n2[5] = { 2,3,4,5,6 };
ptr[0] = &n1;
ptr[1] = &n2;
I am getting errors like:
epi_2.c:20:12: warning: incompatible…

Formal_that
- 37
- 5
1
vote
1 answer
C: String Variable Loses Value After Returning From Void Function
hope you are well.
I recently started learning ADT (Abstract Data Type) in college, and I have an assignment that states the following:
Complete ADTDate adding the following primitive function:
void dayWeekStr(DatePtr date,char *buffer)// places…

Franco N. Sosa
- 25
- 4
1
vote
0 answers
Why is Python walrus operator (:=) needed instead of just using the normal assignment operator (equal sign)?
I just learned there is a walrus operator in Python 3.8
if a := 2 + 3:
print(a) # 5
I wonder why they created a new operator instead of allowing the existing assignment operator as expression, like
(code that throws a SyntaxError follows)
if a…

Randy Sugianto 'Yuku'
- 71,383
- 57
- 178
- 228
1
vote
3 answers
Dynamic python variable creation
I have a variable like YEAR = 2022
Now I want to make a automate variable like Sales_Report_'YEAR's value(2022).
How can I create this type of dynamic variable name in python ?

tanmoy bhattacharya
- 15
- 1
1
vote
1 answer
Having Problems with while - CodeForces 1A
I am having problems with the while function on the C programming language. It runs too many times, Ignoring the end condition.
#include
int main()
{
long long int lenX,lenY,cube,needX,needY,i,t = 0;
scanf("%lld%lld%lld",…

somebodywhoisnotyou
- 25
- 3
1
vote
1 answer
Pass pointer to pointer behaves weird
I am solving Leetcode problem #94 for in-order traversal of a binary tree.
I cannot understand why - when I use &cpy (currently commented) when calling helper() the program works correctly but not when I use &gResult.
int countNode(struct TreeNode*…

Kingkong Jnr
- 1,128
- 4
- 18
- 29
1
vote
0 answers
Is conditionally setting a value by ref correct?
I wanted to know if it is ok to assign a value by ref like this?
Merger A = Merger();
// if Condition is true, B references to A, otherwise a different Merger.
Merger& B = Condition ? A : Merger();
class Merger
{
//...
void MergeMesh(Mesh…

M.kazem Akhgary
- 18,645
- 8
- 57
- 118
1
vote
2 answers
Variable assignments in C with comma operator
I read many questions here but couldn't find my answer, considering following statements:
int x;
x = 1, 2, 3;
this gives x value of 1 however as there are other values separated by , why the rest is discarded? shouldn't it be 3? or is it because of…

user174174
- 119
- 1
- 5
1
vote
10 answers
Having a problem with a Javascript assignment and I have no idea what the solution is, i have tried everything
I am new to programming and I have an assignment which keeps throwing a (Your code could not be executed. Error:ReferenceError: intern is not defined) error.
the last two problems on the assignment are what giving me the issue as I am not completely…

Matt P
- 31
- 2
- 8
1
vote
1 answer
I can't modify ScriptableObject value. [Unity3D]
So, I have a ScriptableObject which stores the KeyCodes for the player input:
InputController.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "InputController", menuName =…

The Riser
- 309
- 2
- 4
- 12
1
vote
1 answer
Alter object value upon assignment to PSCustomObject
I'm creating a log of attempted posts to an API. The API key is stored in a simple hash table and passed via Invoke-WebRequest:
$headers = @{ 'x-api-key' = 'ABC123DEF456GHI789' }
Try {
[Net.ServicePointManager]::SecurityProtocol = 'tls12,…

Tony
- 2,658
- 2
- 31
- 46
1
vote
2 answers
How To Store Column Mean As a Variable
ISSUE
I am performing data cleansing. I have calculated a column mean based on conditions fed into the .loc() function. Storing this output in the z variable is producing a (1,1) dataframe and throwing an incompatibility error when I try to assign…

P-Sides
- 59
- 9
1
vote
0 answers
what is the difference between s[:] and s if s is a torch.Tensor
I'm learning AdaDelta in "Dive Into Deep Learning".I notice that the writer use the s[:] and delta[:] in the function "adadelta".
At first ,I think using s and delta is ok,I change the left part of #1line and #2 line(s[:] -> s,delta[:] -> delta),but…

XUHAO77
- 11
- 3