C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - General Questions (Q.No. 2)
2.
What are the types of linkages?
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.
Internal Linkage-> means static variables and functions with file scope.
None Linkage-> means Local variables.
Discussion:
95 comments Page 4 of 10.
Apple said:
1 decade ago
@shwetha
inc/dec operator has high precedence than arithmatic operators in operator precedence.so,when x=5,
z=(++x)+(++x)
++x => x=6
and
++x => x=7(as x is a variable that can store only a single value)
now,arithmatic operation is performed on it,ie,
z=7+7
z=14
inc/dec operator has high precedence than arithmatic operators in operator precedence.so,when x=5,
z=(++x)+(++x)
++x => x=6
and
++x => x=7(as x is a variable that can store only a single value)
now,arithmatic operation is performed on it,ie,
z=7+7
z=14
Keerthi said:
1 decade ago
Apple,U said right. but easiest way for shwetha
Here
z=(++x)+(++x)
For 1st ++x,the value of x is first increased about one and then assign ,that means the value of x changes from 5 to 6.
Its clear in the same way the 2 nd ++x, x changes from 6 to 7
So, final value of x is 7
That means z=x+x
For 1st and 2nd x's the value is same that is 7
Therefore
Z=7+7
=14.
Here
z=(++x)+(++x)
For 1st ++x,the value of x is first increased about one and then assign ,that means the value of x changes from 5 to 6.
Its clear in the same way the 2 nd ++x, x changes from 6 to 7
So, final value of x is 7
That means z=x+x
For 1st and 2nd x's the value is same that is 7
Therefore
Z=7+7
=14.
Raju said:
1 decade ago
What's is answer for this question:z=(++x)+(x++), if x=2?
Shibu said:
1 decade ago
@raju.... begin from the right most(x++).
x++ -> value remains 2,
now ++x -> 2 incremented to 3. now x contains the final value 3
hence z=3+3
=6
x++ -> value remains 2,
now ++x -> 2 incremented to 3. now x contains the final value 3
hence z=3+3
=6
Santosh said:
1 decade ago
@Nagaraj.
I think you have defined means %d so floating part its not showing 0. 00000, print it using %f you will get right answer.
I think you have defined means %d so floating part its not showing 0. 00000, print it using %f you will get right answer.
Vidya said:
1 decade ago
main() {
char str1[]="Hello";
char str2[]="Hello";
if ( str1==str2 )
printf("True");
else
printf("False");
}
ans:false
please explain the answer
char str1[]="Hello";
char str2[]="Hello";
if ( str1==str2 )
printf("True");
else
printf("False");
}
ans:false
please explain the answer
Vittu agrawal said:
1 decade ago
What is static and non static variables and functions ?
OP Meena said:
1 decade ago
@Vidya.
String variabls can not directly compare by using == operator,
string variable compare by using the strcmp() function in c and c++,
like:
if(strcmp(str1,str2)==0)) printf("String are eqals");
In Java we compare the string by using the equals() method.
String variabls can not directly compare by using == operator,
string variable compare by using the strcmp() function in c and c++,
like:
if(strcmp(str1,str2)==0)) printf("String are eqals");
In Java we compare the string by using the equals() method.
Syeda said:
1 decade ago
For increment operators why we are begining from right most?
Its left priority right?
Its left priority right?
Laxman said:
1 decade ago
What are linkage? Tell briefly.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers