Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
176 views

This is one question encountered while reading the answer of this QA (as ikegami's comment says, how subroutine foo works is complicated. IMHO that may be due to using one outside variable): sub foo { ...
An5Drama's user avatar
  • 774
1 vote
1 answer
177 views

I'm reading some sections of "The C Programming Language" by Kernighan and Ritchie. In the pointers section, the authors state: "The syntax of the declaration for a variable mimics the ...
Mohammed Ashraf's user avatar
0 votes
2 answers
87 views

I'm a beginner learning C programming and I'm wondering the difference between these two formats and why one works and the other does not: // this one doesn't work #include <stdio.h> int main(...
AwkwardLi's user avatar
0 votes
2 answers
79 views

I am attempting to set up some header files for a game, however, attempting to set up variables in my main file's header file causes an incomplete type error. Both types have full definitions in their ...
Heavy Weapons Guy's user avatar
1 vote
3 answers
95 views

I'm trying to use declaration patterns as described here: https://learn.microsoft.com/dotnet/csharp/language-reference/operators/patterns#declaration-and-type-patterns I can see that the examples only ...
Kyle Delaney's user avatar
  • 12.4k
-1 votes
1 answer
50 views

This works fine: package main var foo string func main() { fn := func() { foo = "AAA" } fn() } But if we move the variable declaration inside main(): package main ...
Greendrake's user avatar
  • 3,764
-4 votes
1 answer
69 views

Why doesn't the two different declarations of the variable 't' within the same function cause a conflicting declaration error? (Because it doesn't). Can this way of using the same name for a variable ...
Thomas Nilsson's user avatar
-2 votes
4 answers
381 views

I'm just now learning c# (my second language, first being python) and i thought it was strange that you could declare variables before ever defining what they are. Here's what I mean: string str; //...
nosics's user avatar
  • 29
2 votes
0 answers
124 views

I'm currently writing a compiler in C for my own programming language. Now I'm working on the front-end. I've added functions recently, and now I have troubles with checking if a variable was declared ...
NeTORT's user avatar
  • 39
3 votes
2 answers
485 views

I am trying to declare an array like below arr := [ [0, 0], [1, 2], [2, 4], ] // type: [][]int but the type I am getting from the inference is [][]int, instead I want to declare [][]float32. ...
Visrut's user avatar
  • 762
2 votes
1 answer
145 views

When I try to use an inline variable, then I get a Syntax error. Here's my code: procedure TfrmMain.btnSignInClick(Sender: TObject); begin var UserEmail := edtEmail.Text; var UserPassword := ...
Shaun Roselt's user avatar
  • 4,361
0 votes
1 answer
76 views

im kinda confused how memory allocation for struct variables works and how the struct variables declaration works. My understanding is, that when im declaring a struct variable outside of a function, (...
Socialist2's user avatar
2 votes
2 answers
137 views

I want a JSON array to contain all integers between 0 and 1000, but I don’t want to declare each element of that very long array individually. Is there a more economical/elegant way to declare that ...
Felipe Evaristo's user avatar
0 votes
1 answer
79 views

i have been trying to make a for loop where at i < j. Variable J takes the length of a string to decide how many loops will happen. This works for the first loop, i have debugged and J does get the ...
Boriscodes's user avatar
1 vote
0 answers
35 views

I'm really struggling with my final project for my first ever coding course. Situation: I'm able to successfully retrieve data from Geonames API, that looks like this: Geonames API response: { lat: ...
AnnaG's user avatar
  • 11
1 vote
2 answers
601 views

I'm getting the following error message: The variable '$dateTime' cannot be retrieved because it has not been set. The error is generated by the line [DateTime]$dateTime in this code: [string]$...
aksarben's user avatar
  • 666
0 votes
1 answer
195 views

It's been at least a decade since I last touched C++. Supposedly, C++ has had a minor overhaul. Is there a way to specify the bit width of a type without using struct, class, or union bitfields? The ...
ATL_DEV's user avatar
  • 9,658
1 vote
0 answers
59 views

I am trying to initialize a container for my Fyne GUI, I declared it globally here: var w fyne.Window var content *fyne.Container Then I initialized it in main() func main() { a := app.New() w = a....
T. J. Foster's user avatar
0 votes
1 answer
51 views

I am working with pseudocode taken from Exploration Tools (section "Arm A64 Instruction Set Architecture", button "Download XML"). bits(16) BFSub(bits(16) op1, bits(16) op2, ...
pmor's user avatar
  • 6,757
0 votes
1 answer
81 views

I want to understand what the following declaration means: constexpr auto type = u"bluetooth-opp-transfer-complete"_ns; I know constexpr evaluates things at compile time, but what does u ...
user1237538's user avatar
0 votes
1 answer
588 views

I am working on writing the pseudocode for a calorie counting program that calculates the total weekly calories for breakfast. the program should allow the user to enter the number of calories ...
Heidihale58's user avatar
0 votes
3 answers
2k views

I'm reading K&R and started wondering, why do variables need to be declared before they are used, but functions dont? In C, all variables must be declared before they are used, usually at the ...
curiousCprogrammer1231's user avatar
8 votes
6 answers
3k views

I want to perform Destructuring in php just like in javascript code below: [a, b, ...rest] = [10, 20, 30, 40, 50]; console.log(a,b,rest); Output: 10 20 [ 30, 40, 50 ] How can I preform that ...
Zaid Malek's user avatar
6 votes
3 answers
924 views

In The C Programming Language, 2nd Edition, by authors Brian W. Kernighan and Dennis M. Ritchie, they talk about declarators and direct-declarators. The discussion starts in the book on p. 122 with ...
Joshua Ginn's user avatar
0 votes
1 answer
40 views

I'm making a BMI calculator and it works only one time. Which I don't understand. I initialised 2 let variables outside the click event handler just to get the input elements. When I wanted to convert ...
Duuliye's user avatar
0 votes
1 answer
553 views

I have a React component called Flightlist, which receives an object from its parent component via props.newFlight. I would like to push each object received from the parent to a local array, called ...
KapteinKonyn's user avatar
0 votes
2 answers
98 views

I was having this problem to which I have come to the solution through the trial and error process but I have no idea why my bubble sort function wasn't working in the first place. The problem had to ...
Dimitris's user avatar
-2 votes
1 answer
45 views

my code: SqlConnection con = new SqlConnection(@"DATA;"); SqlDataAdapter cmd = new SqlDataAdapter(); cmd.InsertCommand = new SqlCommand(" UPDATE TIME ...
Dennys's user avatar
  • 3
0 votes
3 answers
185 views

Which one is recommended while writing Clean Code in C# or it doesn't matter? a) int count = 0, sum = 0; b) int count = 0; int sum = 0; I personally write code with b) style. I almost forgot that we ...
Kuvondik's user avatar
-4 votes
1 answer
94 views

I found this in a program. What does it mean? uint8_t x(uint8_t, uint8_t, uint8_t) I'm new to C/C++ and I'm poking around the net to see how others are doing things. I'm sure there's a way to google ...
joelindo's user avatar
0 votes
0 answers
38 views

I am trying to allow a user to insert a file and then send it in an email, but I don't know how to receive that file. There is an error on the "System.IO.File" part of my code that says &...
Ty Vents's user avatar
0 votes
1 answer
144 views

I'm trying to implement (a simplified version of) Representable for my data type, but I'm not allowed to use the first data type parameter in the definition: question.hs ----------- {-# LANGUAGE ...
orfeas's user avatar
  • 1
0 votes
3 answers
967 views

I found this in Javascript.info : enter link description here. Well it's a event delegation demonstration : a 9-cells table, when we click one of cells, the cell (event.target) changes its color into ...
Herma's user avatar
  • 53
2 votes
2 answers
1k views

I believe the following is a relatively common pattern (the exact types used are not important, they're just for example): std::vector<std::string> manufactureVector(int param1, const std::...
Glen Whitney's user avatar
-1 votes
1 answer
88 views

I have seen at stackexchange some answers with C++ but I need the answer at C#, please. I must use a loop to add several MapPolylines to a map. If I don't declare a new one the last MapPolyLine is ...
Luis Novais Reis's user avatar
0 votes
1 answer
392 views

I wonder if it is possible to concatenate a variable value or a string to a new variable value declaration in Ruby. foo = "something" #new variable declaration: var_ + foo = "concat ...
Marcelo Alarcon's user avatar
0 votes
3 answers
51 views

So here, I want to solve one of the problems in my basic programming class. So, the problem is, we should count the vowel letter and print how many A/a, I/i, U/u, E/e, and O,o letters are in a string. ...
Clarkieeeyyy's user avatar
1 vote
0 answers
52 views

I'm curious why both of the following code segments produces error CS0165: Use of unassigned local variable 'i': // Attempt #1 object obj = 4; bool isInt = obj is int i; if (isInt) Console....
Jeff G's user avatar
  • 4,735
0 votes
1 answer
48 views

Recently, I received this interview question, I know it's weird to declare var name and function name the same, but the code runs without errors, and I don't know how to explain this behavior, hence ...
Wenfang Du's user avatar
0 votes
0 answers
13 views

It turns out you can declare a variable in one case block and use it in another! At least in compile time anyway, at runtime it will throw an error or be undefined, depending on the interpreter ...
kajacx's user avatar
  • 13.1k
1 vote
0 answers
81 views

Why are const declarations within a while loop not an issue? Isn't the same variable being redeclared in each iteration? In the code below, the arrValue variable is declared within the loop. I felt ...
Phil F's user avatar
  • 11
1 vote
5 answers
7k views

My problem is I want to initialize a multidimensional array declared like this: int[][][] my3DArray; However, the following code gives me an error on [sizeY][sizeZ] saying it expected ',' or ']'. ...
Rafael Silva's user avatar
-1 votes
2 answers
785 views

I have a Javascript function declartions as a string (gotten from Function.toString), and I want to wrap all variable declarations with a function (also in Javascript), E.g. const value = 42 to const ...
Ayo Reis's user avatar
  • 651
0 votes
1 answer
2k views

I looked at all of the other questions about this error, but none of them helped. I am trying to create a reference to a button in my layout file, and when I set the onClickListener, I get "...
Chadcock's user avatar
0 votes
1 answer
2k views

I am trying use the data from a column in one table as column aliases of another table. DECLARE var1 VARCHAR(20), var2 VARCHAR(20); BEGIN WITH TABLE1 AS (SELECT ROWNUM RN, * FROM TABLE) ,A1 ...
Divya T's user avatar
0 votes
2 answers
52 views

So I am learning pointers and i think I mostly understand how they work but Im still learning how to use them correctly. I wrote this code that receives a pointer to a list with pointers innit, each ...
tomhoq's user avatar
  • 57
1 vote
2 answers
55 views

I just started learning C. I have a function with two outputs, a value and an estimated error. double result, abserr; gsl_deriv_central (&f_var, rho, 1e-8, &result,&abserr); I only care ...
Tomás Alvim's user avatar
0 votes
0 answers
58 views

I am using a struct to store records that include many optional fields, e.g., struct record { var age: Int? var ID: String? var firstName: String? var lastName: String? } Ideally I ...
DickWeaselton's user avatar
0 votes
1 answer
500 views

When I try to make static pattern variable I receive an error: Modifier 'static' not allowed here. I can't see any reasons, why it doesn't work. Do you have any ideas? This is how I try to do it: ...
s1ckoleg's user avatar
0 votes
1 answer
1k views

I wanted to declare a fixed value before implementing various chunks of queries, and tried the following method. Unfortunately, no values are returned. Any advice will be much appreciated. SET ...
abc196998's user avatar

1
2 3 4 5
14