C:#define inside function body [closed] - c

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
# define a 10
main()
{
#define a 50
printf("%d",a);
}
The output is coming 50. Why is it happening so? Shouldn't the output come 10?

Compilation happens from top to bottom. so value of a is replaced by 50 when it enters into main function.
Here the local has precedence than global

Related

TSQL: I have one basic querying problem qr [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
Query:
DECLARE #Patd_base nvarchar(50) = '‪axx';
PRINT #Patd_base
Output is
?axx
Why is the ? in the output? What does it mean?
Thanks for the help!
I believe you copied and pasted the value 'axx' from elsewhere. It has a hidden extended character in it.
When I copy/pasted your command above into Notepad++, and converted to ANSI encoding, I got '‪axx'

What is wrong with my code (it doesn't call the function)? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
What is wrong with my code? It it doesn't call the function (I am an absolute beginner, just started 3 days ago).
#include<stdio.h>
#include<stdlib.h>
void whyy();
int main(){
void whyy();
}
void whyy(){
printf("lllllllllllll");
}
The void whyy(); line inside main is declaring a function, not calling one. To call the function, just name it (with its required ()):
int main(){
whyy();
return 0;
}

printf("%f",5/4) in C language returns 0.00000 unexpectedly [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
This post was edited and submitted for review 10 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
it prints out 0.000000
I expected 1.2500000000
Why is it happening?
You are doing integer division by 5/4 and trying to print the result in float. So the behavior is ambiguous. You can try this to get the desired result:
printf("%f",(float)5/4);

undefined reference to <function name> in the same project file [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I'm using codeblocks IDE and I don't know what is the problem.
I tried making the variables global but it still doesn't work.
The problem is in the function name. Calculate_area has a capital 'C' in its function declaration name, but not in the prototype declaration.
Change your function declaration at line 31 with:
unsigned long calculate_area(unsigned long side);

Use array variable in as argument to command [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I have to use an array in a command that is stored in a variable:
# Array
DOMAIN="${DOMAIN:-example.com}";
GETIP=$( dig +short "${DOMAIN}" ) # No output
The following command is working:
dig +short example.com
I can not reproduce your problem:
DOMAIN="${DOMAIN:-example.com}";
GETIP=$( dig +short "${DOMAIN}" )
echo "$GETIP"
Output:
93.184.216.34
The problem was that I used the Variable outside of the scope.

Resources