ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
what is the difference between declaration ,defenetion and 
initialization of a variable?
 Question Submitted By :: Anjeereddy
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is the difference between declaration ,defenetion and initialization of a variable?
Answer
# 1
declaration : int a; 
declaration means here a is declared as integer variable 
initialization : int a = 5;
initialization is whatever you have declared give that 
variable some value
definition : int a;
definition is whatever variable you have declared give it's 
datatype as here a is declared as integer variable
 
Is This Answer Correct ?    5 Yes 0 No
Siddiqui Mohd. Faisal
 
  Re: what is the difference between declaration ,defenetion and initialization of a variable?
Answer
# 2
declaration means you declare variable.
ex: int a;
defination means this integer type a variable take 2 byte 
memory space.
initialization means we initialize the value of integer a 
variable type. 
ex: int a=2;
in declaration we declare variable and variable type , in 
initialization we define the value and in defination we 
define the type of variable.
 
Is This Answer Correct ?    4 Yes 0 No
Nirmal Kumar Tailor
 
 
 
  Re: what is the difference between declaration ,defenetion and initialization of a variable?
Answer
# 3
A good example to illustrate this Question ges like this:

   Whenever we apply for a job the company declares that we 
have been selected. Similarly we declare a variable like 
 
    int emp;
         (here emp behaves as an employee).

   Then he will be assigned with a initial salary which 
will be incremented in course of time period or on 
experience basis.
        Similarly the variable int is assigned a initial 
value.
            i.e int emp=20; 
             (value can be changed in between program)

      The employee is now identified by his post, which can 
define his status in the company.
          Same way the variable is also defined in the 
program.
             ie. int emp;
 
Is This Answer Correct ?    1 Yes 0 No
Shabeer V C
 
  Re: what is the difference between declaration ,defenetion and initialization of a variable?
Answer
# 4
As i know.....
Definition is one which allocates memory.
Ex: int x;

Declaration never occupy any memory space.
Ex:Function prototype declarations such as....
    int func(int,int);

Initialization: If any variable assigned with some value at
time definition itself is called initialization.
Ex:int x=0;
 
Is This Answer Correct ?    2 Yes 0 No
Gg
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
WAP to accept first name,middle name & last name of a student display its initials? NIIT1
plz answer.. a program that takes a string e.g. "345" and returns integer 345  2
What is an anonymous union and where to apply that ? HP1
what is the diff between the printf and sprintf functions?? and what is the syntax for this two functions ??  4
write the program for prime numbers? TCS7
44.what is the difference between strcpy() and memcpy() function? 45.what is output of the following statetment? 46.Printf(“%x”, -1<<4); ? 47.will the program compile? int i; scanf(“%d”,i); printf(“%d”,i); 48.write a string copy function routine? 49.swap two integer variables without using a third temporary variable? 50.how do you redirect stdout value from a program to a file? 51.write a program that finds the factorial of a number using recursion?  3
To what value do nonglobal variables default? 1) auto 2) register 3) static  4
What are advantages and disadvantages of recursive calling ? HP6
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice) Subex1
write a code for large nos multilication (upto 200 digits) Persistent1
can i know the source code for reversing a linked list with out using a temporary variable? Honeywell3
Which of the following about automatic variables within a function is correct ? a.its type must be declared before using the variable b.they are local c.they are not initialised to zero d.they are global. TCS3
why i join syntel? Syntel11
how to find out the reverse number of a digit if it is input through the keyboard?  1
post new interiew question and aptitude test papers  1
program to find the second largest word in a paragraph amongst all words that repeat more thn twice iGate2
what's the o/p int main(int n, char *argv[]) { char *s= *++argv; puts(s); exit(0); } Motorola1
difference of two no's with out using - operator  4
why java is called as a purely oops language.  2
how many error occurs in C language ? Wipro9
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com