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 2 of 10.
Manoj mehra said:
5 years ago
In programming languages, particularly the compiled ones like C, C++, and D, linkage describes how names can or can not refer to the same entity throughout the whole program or one single translation unit. The static keyword is used in C to restrict the visibility of a function or variable to its translation unit.
(8)
Ago balan said:
1 decade ago
int a; --> Here a is a variable of integer. We can increment the value of a using for loop.
static int a; --> Whenever 'a' is called at any line in a program 'a' value is assigned automatically that value is previous value of a we used sometime earlier in program. Actually static is storage class.
static int a; --> Whenever 'a' is called at any line in a program 'a' value is assigned automatically that value is previous value of a we used sometime earlier in program. Actually static is storage class.
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.
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
Rajesh said:
1 decade ago
We declare already a static varible, in derived class we declare one more same static variable as declared first with different value, and call the previous variable,.......then.....Is the out put of program is first variable's value or secon variale's value...
Nanthakumar said:
9 years ago
@Anil.
#include <stdio.h>
int main()
{
int i = 2;
int j = ++i + i;
printf("%d\n", j);
}
I=2
First pre inc I=3.
Then latest value of i is 3 only no post inc can accessed in (++I)+(i)
So, 3+3 is equal to 6.
#include <stdio.h>
int main()
{
int i = 2;
int j = ++i + i;
printf("%d\n", j);
}
I=2
First pre inc I=3.
Then latest value of i is 3 only no post inc can accessed in (++I)+(i)
So, 3+3 is equal to 6.
Tiger said:
1 decade ago
@Karthick we use the return in the program because the return any value for example.
#include<stdio.h>
int main()
{
int i=5;
return i;
}
Output of the above program is 5 because it will be return the value of the i.
#include<stdio.h>
int main()
{
int i=5;
return i;
}
Output of the above program is 5 because it will be return the value of the i.
Shiny said:
1 decade ago
Why external linkage means global, non static, functions?
Why internal linkage means static variables, functions with filescope?
Why none linkage means local variables?
Please give clear information about those three.
Why internal linkage means static variables, functions with filescope?
Why none linkage means local variables?
Please give clear information about those three.
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.
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.
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?
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?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers