What is the difference between declaration and definition?
Answer Posted / rajesh manem
Ans: The declaration is means the memory is not yet all to
be allocated..
For example:
Int a; //is it declaration? Or definition?
Just check this
Int main()
{
Int I;
Printf(“%d”,i);
}
It prints the garbage value that means the memory is
allocated for this declaration so we can say that this int I
is both declaration and definition.
And take another example extern int I -- declaration
because no memory is allocated.
Similarly for function prototypes all are declarations.
In the case of class declaration String s; // Declaration
[because reference is created]
When the new keyweord encounters then it is definition
String *s=new Stirng(); //declaration and
definition
Is This Answer Correct ? | 38 Yes | 4 No |
Post New Answer View All Answers
What are the 4 main oop principles?
What is polymorphism used for?
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?
What is oops in programming?
Can a destructor be called directly?
What is the highest level of cohesion?
hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.
What is object and example?
Why is abstraction used?
Is data hiding and abstraction same?
What is the full form of oops?
What is abstract class in oop?
Can you inherit a private class?
What does it mean when someone says I oop?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.