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.

Sandeep said:   1 decade ago
When x=2,
if z=x++ + ++x.
Then z=?

Manukumar said:   1 decade ago
What is linkages? how it affects the c program in terms of memory or storage class?

Bhavani said:   1 decade ago
@Moumita.

When x=5 then,

Z=++x + ++x;

Is printing 14 not 13.
I checked it guys,

x = 7 at last, Because a value of a variable(x) vl hold the latest value that's being stored in the memory(i.e) 7.

So z = 7+7 = 14.

Mounika said:   1 decade ago
13 because here first x = 5.
Then ++x = 6(pre increment).

Now x = 6.
Then ++x = 7.

So z = ++x + ++x.
z = 6+7 => 13.

Moumita said:   1 decade ago
Guys please check this once more.

When x =5 then,

Z=++x + ++x;

Is printing 13 not 14....

So what is the actual explanation?

Vams said:   1 decade ago
@Aliya.

C compiler does parsing (reading and evaluating) from left to right of each line of code. That is purely related to compiler design(cd) topic for further details refer cd of C language.

Aliya said:   1 decade ago
@Praveen:

Why the evaluation is done from the right most i.e; x++.

++x=3; the value of x=3.

x++=3; we do not increment here since its a post inc.

++x + x++ = 6?

Why aren't we considering pre inc first?

Lavanya said:   1 decade ago
Give details of linkages & when they are used?

Gaurav said:   1 decade ago
@Praveen.

Why x++ value remains 2?

Why it is not incremented by 1?

Jhansi said:   1 decade ago
Give details of linkages & when they are used?


Post your comments here:

Your comments will be displayed after verification.