Declaration is the part of the subprogram (procedure or function) which provides the protocol(header), but not the body of the subprogram.
Questions tagged [declaration]
3407 questions
1
vote
1 answer
Is a declaration an expression in SML?
in SML, is a declaration (val-declaration, type declaration, ...)
an expression
a statement which, if I am correct, is defined as an expression with side effect
or something else?
Thanks.

Tim
- 1
- 141
- 372
- 590
1
vote
2 answers
List compiles, but gives warning: incompatible pointer type
#include
#include
typedef struct
{
int number;
struct player *next;
}player;
player *newPlayer;
player *firstPlayer;
player *currentPlayer;
int main(void)
{
newPlayer = malloc(sizeof(player));
firstPlayer =…

J0S
- 145
- 7
1
vote
2 answers
What are the differences between string literal and const string literal
What is difference between two definitions below:
char *str1 = "string 1"; // (1)
const char *str2 = "string 2"; // (2)
(1), is this an undefined behavior for string literal ?
If no, what is definition we should use (can you give me some…

Hitokiri
- 3,607
- 1
- 9
- 29
1
vote
0 answers
How can I update my old fortran 77 script to f90 or newer one?
I usually deal with data file with multiple data block, repeating n number of lines for m number of times.
This is one of the example:
9276
4900000
AA 4 4 6260 519 8350 1571 0 0 0 0 0 …

exsonic01
- 615
- 7
- 27
1
vote
1 answer
Call one procedure in another, that was declared before it
I have a situation:
procedure Compile();
begin
//stuff
CompileBatch();
end;
procedure CompileBatch();
begin
//stuff
end;
But that obviously doesn't work, because identifier "CompileBatch" is not yet found in Compile. Are there any…

GreatCorn
- 81
- 12
1
vote
1 answer
-Wimplicit-function declaration in C
I dont understand how this is implicit I return an int in every function and all of them are before the main function. Honestly first time seeing this someone send me a long code to debug and there were alot of mistakes but why isnt this working…

hohenpaid
- 99
- 9
1
vote
2 answers
Declaration and definition mismatch
A declaration and definition mismatch in my template class (everything irrelevant has been cut out):
template
class WidgetLanguageManager
{
public:
enum class Language { DE, ENG, PL };
protected:
…

slavic-d
- 33
- 3
1
vote
2 answers
Select certain elements in array to create new array
How could I select a certain number of elements from an array by giving a start and ending index number to create a new array?
For example, if my original array was {1,2,3,4,5,6}, and I say x=0 and y=2 for their index values, I would have a new…

temo
- 69
- 5
1
vote
1 answer
Reference initialization with constructor
const T a {}; // constant of type T
const T& b {}; // ???
T c {}; // variable of type T
T& d {}; // error
What is the difference between a and b?
b is a reference but I don't assign a object to it: in that instruction I initialize…

DPD-
- 412
- 1
- 5
- 15
1
vote
1 answer
C - problem with const - error: initializer element is not constant
I try add global variable in my buttons.c file, but have a error - initializer element is not constant. Example headers.h file
struct MainStruct {
GtkEntryBuffer *buffer;
GtkWidget *entry;
GtkWidget *label;
};
extern struct MainStruct…
user9690594
1
vote
0 answers
Is the behavior of declaring loop index in for loop header defined in C++ specification?
When I was reading Code Complete 2nd Edition, there was a piece of code:
for ( int recordCount = 0; recordCount < MAX_RECORDS; recordCount++ ) {
// looping code that uses recordCount
}
// intervening code
for ( int recordCount = 0; recordCount <…

johnlinp
- 853
- 6
- 22
1
vote
1 answer
Compilation error in function declaration in C
I am getting errors during the compilation of this C program and is related to the declaration of the function. What is the problem here? When I declare void display(student); it shows a warning but if I change to void display(struct student st) it…

Sudarshan
- 96
- 6
1
vote
0 answers
Array in private scope from public scope but variable is not in same class ['d' does not have a type]
Run the code to see where the problem lies.
[Error] 'd' does not name a type
I tried declaring the variable directly in public but it kept popping up with more errors.
There seems to be apparently no fix, since googling didn't help much in the…

Ankan Das
- 268
- 1
- 2
- 11
1
vote
0 answers
How to declare a struct in a header file and initialize it in another .h file?
I am a beginner in programming in C, and I am trying to make my code as modular as possible, so I want to declare a structure,
enum TRANSMITER_INT
{
DISABLE,
ENABLE
};
typedef struct Config
{
enum TRANSMITER_INT TRANSMITER ;
}Config;
and…

Ahmed Essam
- 11
- 2
1
vote
1 answer
Why is the function only returning the multiplied value?
Why this code is returning 500 and some garbage value? Why isnt the divide function working?
#include
int divmul(int v1, int v2)
{
int div,mul;
div =v1/v2;
mul=v1*v2;
return div,mul;
}
main()
{
int val1=50, val2=10;
…

Akash
- 54
- 1
- 3