C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - General Questions (Q.No. 2)
2.
What are the types of linkages?
Internal and External
External, Internal and None
External and None
Internal
Answer: Option
Explanation:
External Linkage-> means global, non-static variables and functions.
Internal Linkage-> means static variables and functions with file scope.
None Linkage-> means Local variables.
Discussion:
95 comments Page 5 of 10.

Anil said:   9 years ago
#include <stdio.h>
int main()
{
int i = 2;
int j = ++i + i;
printf("%d\n", j);
}

Output = 6.

How is it possible? Please give me an explanation.

BALAMURUGAN said:   9 years ago
How you can classify those linkages respectively. Please tell me.

Ashwini said:   9 years ago
@Saiba Murmu.

GCC compiler also giving the result : 8.
Check it once.

Ashwini said:   9 years ago
What is the difference between that all three linkages?

Sarathi said:   10 years ago
Difference between GCC and TCC compiler?

Saiba Murmu said:   1 decade ago
It gives result according to the compiler.

GCC compiler gives Result: 9.

TCC compiler gives Result: 8.

Explanation:

In GCC compiler, variables are stored in stack memory area. First value 4 is stored after incrementing by the pre-increment operator then second value 5 is stored after increment. So the Result is 9.

But in case of TCC compiler first value 4 is stored in stack then before increment the second value of x=4 is stored. So the Result is 8.

Kasthuri said:   1 decade ago
@Kavitha.

It will give only 8 as the output.

Manoj said:   1 decade ago
@Kavitha.

It will give the output 8 only!

Silpi roy said:   1 decade ago
What are linkages?

Sameer said:   1 decade ago
What is the meaning of functions of filescope?


Post your comments here:

Your comments will be displayed after verification.