+ 18
Find the error in my code.
10 odpowiedzi
+ 9
#define is a macro that when used in the expression/statement is replaced.
So your statement becomes
const int 19 = 7;
Which results in an error
+ 9
constant value cant be changed
+ 8
#define a 19
const int b = 3
In both cases a y b are constant numbers and you couldn't override them.
+ 8
Constant value does not change
+ 6
You replace a by 19.
So in your code really stands written:
19 = 7;
And you can't assign a number to another number, only to a name.
+ 4
You can't redeclare const variable inside int main or anywhere, delete const int a or change a to something else
+ 2
You cannot redeclare a preprocessor macro as constant in a function.
+ 1
You define 'a' as 19 already
So no matter you define it constant or anything it take it as 19
+ 1
#include <stdio.h>
const a=19;
int main() {
const int a=7;
printf("a=%d",a);
}U should write const keyword
0
Two problem... 1) u have initiated a macro value named as a and then Changing value to 7
2)int main() should have a return value