Questions tagged [declaration]

Declaration is the part of the subprogram (procedure or function) which provides the protocol(header), but not the body of the subprogram.

3407 questions
1
vote
1 answer

declaring and using a overall dictionary in vba

im new to programming and especially new to vba, but i'm trying my best and now i need your help! So what i would like to achive: I made a interface in word. There are multiple buttons. If one button is clicked, the programm should check if the…
1
vote
2 answers

Able to access struct member through character in c?

Basically I have a struct with several members, named a-z. I have a string where I want each letter to correspond to the correct struct member. Currently I use a switch statement with each case in order to access the correct letter member of the…
1
vote
4 answers

Variable/Type declaration private by default

Is there a way to make the default access modifier public for variable/method/class declarations? I think by default, class declarations are private yes?
user76071
1
vote
2 answers

Casual value of a not initialized pointer to pointer

When I define a pointer without initializing it: int *pi; it points to a random part of the memory. What happens when I define a pointer to pointer without initializing it? int **ppi; Where does it point? It should points to another pointer, but I…
Gennaro Arguzzi
  • 769
  • 1
  • 14
  • 27
1
vote
2 answers

Included Class Type is apparently not declared, why?

I have the following issue thrown by the compiler: include/FlowChannel.h:14:21: error: ‘LatticeCell’ was not declared in this scope std::vector grid; when having these 3 header files (LatticeCell.h, FlowChannel.h and Utilities.h) and 2 cpp files…
1
vote
0 answers

Use Typescript declared module inside own declaration file

My Javascript is running inside V8, which has a module foo:bar/baz available for import which is resolved by C++. I'm trying to write Typescript definitions for this module, so clients can interface with it in a type safe manner. Here is the actual…
DontTurnAround
  • 684
  • 1
  • 7
  • 20
1
vote
1 answer

Why is it allowed to redeclare a static function as extern?

Why does GCC allow re-declaration of a 'static' function inside the same translation unit, like so: static int foo(void); extern int foo(void) { return 0; } when the opposite is not allowed: extern int foo(void); static int foo(void) { …
zonk
  • 11
  • 1
1
vote
2 answers

Simplify declarations of classes that use the CRTP pattern

I used the "Curiously Recurring Template Pattern" to inherit a static member variable and an instance getter. Sounds contrived, but the project will have many many subclasses that need to be declared as painlessly as possible, without duplicating…
Crazor
  • 328
  • 1
  • 12
1
vote
2 answers

I want to understand in detail distinct between expression and statement in C++. Pls pick concrete example to explain that

Now I am learning C++ programming. I didn't understand the distinction between expression, definition, declaration, and definition. As Wikipedia says, In "Statement(computer science)" In most languages, statements contrast with expressions in that…
1
vote
1 answer

C++ Declaring a variable with the ternary operator

I was wondering if it's possible to do something like this. (i know it's really weird ^^) bool B(true); std::vector< (B == true) ? bool : int > v;
user13286774
1
vote
1 answer

Delphi Component Property Declaration

Recently, I came across the following property declaration in the component TDBNavigator: property Enabled; [Default(False)] <-------------------- property Flat: Boolean read FFlat write SetFlat default False; What does the directive…
Elivaldo
  • 93
  • 4
1
vote
1 answer

Why is this working? I can't understand why my code works in C

I am currently learning C and I have come across this strange behaviour (based on my understanding): I have 2 files: file1.c #include int main() { printNumber(2); return 0; } file2.c void printNumber(int number) { …
user13662539
1
vote
3 answers

error: dereferencing pointer to incomplete type - C language

A few days ago I made a function, which worked just fine. This is struct defining I used. typedef struct { int data; struct Node * next; } Node; typedef struct { Node * head; Node * current; int size; } List; Then I have this…
me995
  • 59
  • 1
  • 6
1
vote
1 answer

Declaring array in C++ like array[1-00] by mistake but still code works, output is incorrect?

When i declare array as array[1-00] by mistake i didn't get the right answer. But when i change it to normal declaration like array[100] i clear all the test cases. Can anyone provide any explanation for this type of problem? Please.
1
vote
5 answers

Can I declare variables in C in the body of do-while statement?

I've just began my journey in coding and i've been using cs50's IDE. everytime I declare an integer in the main body of do function, I get an error for using undeclared indentifier when I try using the same integer in the body of while function, is…