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:
96 comments Page 8 of 10.
Nidhi gupta said:
1 decade ago
What is static and non-static variables?
Anitha said:
1 decade ago
How can we print a string without using printf() and any other functions like puts() & get() ?
Sameer said:
1 decade ago
What is the meaning of functions of filescope?
Purnima said:
1 decade ago
Can you give me the brief explanation about linkages and what are the storage classes?
Sumanth said:
2 decades ago
Thanx Dixin
DixN said:
2 decades ago
The reason is
x=5
++x means x=6
then ++x means x=7
then only it will start to add
z=x+x
but at the end x=7
therefore
z=7+7
ie z=14 is the answer
x=5
++x means x=6
then ++x means x=7
then only it will start to add
z=x+x
but at the end x=7
therefore
z=7+7
ie z=14 is the answer
Gaurav said:
2 decades ago
x= 5;
z = ++x + ++x ;
cout<<z;
why does this display 14 , instead of 13 ?
z = ++x + ++x ;
cout<<z;
why does this display 14 , instead of 13 ?
Saikiran said:
2 decades ago
What Prathyusha said is correct. That can be easily understood using this program.
#include<stdio.h>
int main()
{
printf("\n%d",funi());
printf("\n%d",funi());
printf("\n%d",funi());
printf("\n%d",funj());
printf("\n%d",funj());
printf("\n%d",funj());
//printf("\ni=%d\nj=%d",i,j);
return 0;
}
int funi()
{
int i;
i++;
return i;
}
int funj()
{
static int j;
j++;
return j;
}
output:
1
1
1
1
2
3
#include<stdio.h>
int main()
{
printf("\n%d",funi());
printf("\n%d",funi());
printf("\n%d",funi());
printf("\n%d",funj());
printf("\n%d",funj());
printf("\n%d",funj());
//printf("\ni=%d\nj=%d",i,j);
return 0;
}
int funi()
{
int i;
i++;
return i;
}
int funj()
{
static int j;
j++;
return j;
}
output:
1
1
1
1
2
3
Siri said:
2 decades ago
Good explanation pratyusha, thanq so much.
Ram krishna said:
2 decades ago
I will thank full to Satish Narasimman and Prathyusa, who cleared my doubt.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers