What is diffrance between declaration and defination of a variable or function

Answers were Sorted based on User's Feedback



What is diffrance between declaration and defination of a variable or function..

Answer / deepak mundhada

1 when we declare a variable it gets memory allocated at
stack in ram.
definition means we are assigning value to that variable.

2 address of variable can be changed but address cant be
changed.

Is This Answer Correct ?    4 Yes 0 No

What is diffrance between declaration and defination of a variable or function..

Answer / r.ramakrishna

Declaration means allocating memory for the variable.
Definition means defining address of the variable in a class.

Is This Answer Correct ?    3 Yes 1 No

What is diffrance between declaration and defination of a variable or function..

Answer / nagarjuna reddy

once a variable is defined it'l never change through entire
program.
but declaration of a variable can be changed as per our
requirement.

Is This Answer Correct ?    3 Yes 1 No

What is diffrance between declaration and defination of a variable or function..

Answer / manish soni bca 3rd year jaipu

IN FUNCTION;
-------------------------------------------
1:)DECLARE: int sum(int);//close with semicolon;

2:)DEFINATION: int sum(int n)//not colse with semicolon;
{
//logic of the function;
}

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Interview Questions

How can a program be made to print the line number where an error occurs?

0 Answers  


What does %2f mean in c?

0 Answers  


Describe explain how arrays can be passed to a user defined function

0 Answers  


In which area global, external variables are stored?

3 Answers  


what is data structure

5 Answers   Maveric, TCS,






#include<stdio.h> main() { int a[3]; int *I; a[0]=100;a[1]=200;a[2]=300; I=a; Printf(“%d\n”, ++*I); Printf(“%d\n”, *++I); Printf(“%d\n”, (*I)--); Printf(“%d\n”, *I); } what is the o/p a. 101,200,200,199 b. 200,201,201,100 c. 101,200,199,199 d. 200,300

4 Answers   Tieto,


what will be the out put. #include<stdio.h> void main() { printf("Output:"); printf(1+"vikashpatel"); }//output: ikashpatel

1 Answers   V2 Solutions,


How to add two numbers with using function?

4 Answers  


how can i sort numbers from ascending order and descending order using turbo c..

1 Answers  


Once I have used freopen, how can I get the original stdout (or stdin) back?

0 Answers  


#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }

1 Answers  


in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?

2 Answers   NetApp,


Categories