Skip to main content
2 votes
1 answer
170 views

What is the difference between alias `our` and the original global variable?

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
  • 782
1 vote
1 answer
166 views

Does "Declaration Reflects Use" Rule Apply to C++ Reference Variables?

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
79 views

Declaration Statement Format Difference

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
73 views

Incomplete type cannot be defined

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
92 views

How can I use a declaration pattern outside of an if condition?

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
49 views

Variable used inside function reported not used

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,754
-4 votes
1 answer
66 views

Why doesn't this C++ code cause a conflicting declaration error? [duplicate]

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
373 views

Why would anyone declare a variable before defining it? Please provide example [closed]

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
121 views

Writing a compiler frontend. When should I check if a variable was declared or not?

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
458 views

how to declare an array with explicit type in vlang?

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
141 views

Inline variables aren't working in TMS Web Core

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,263
0 votes
1 answer
76 views

C - Struct variable inside callee function, should it be a pointer or dosent it matter

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

Can I declare an array of integers in JSON without listing each element explicitly?

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

my variable resetting after one loop in a for loop, not sure why

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

Can't pass lat, lng to weatherbit API, ReferenceError: data is not defined

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

15 30 50 per page
1
2 3 4 5
46