473,320 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

data definition and data declaration

What is difference between "data definition" and "data declaration"?
Nov 12 '07 #1
4 2618
A declaration establishes the names and characteristics of data objects used in a program. A definition allocates storage for data objects, and associates an identifier with that object. When you declare or define a type, no storage is allocated...

for more info check
http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/data_dec.htm
Nov 12 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
When you declare or define a type, no storage is allocated...
Not true.

When you declare a type no storage is allocated.

When you define a type, then storage is allocated.

You said it yourself in the previous sentence and then seemed to contradict yourself. Probable just a typo but I wanted to be sure the OP was not misled.
Nov 12 '07 #3
Not true.

When you declare a type no storage is allocated.

When you define a type, then storage is allocated.

You said it yourself in the previous sentence and then seemed to contradict yourself. Probable just a typo but I wanted to be sure the OP was not misled.
Thanks 4 that.
but can u plz give me exp like
int a=0;
this is included in definition right and
int a;
this is a declaration that ur identifier is of integer type?
Nov 12 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
but can u plz give me exp like
int a=0;
this is included in definition right and
int a;
this is a declaration that ur identifier is of integer type?
int a = 0; is a definition. Memory is allocated. The value of the int is 0.

int a; is a definiton. Memory is allocated. The value of the int is garbage.

A declaration of than integer requires that no memory be allocated. The only way that can happen is if the int is in some other source file. In that case you can declare an int:

extern int a;

The compiler will report the int as an unresolved external reference. This will cause the linker to go find the int and connect it to the code in this source file.
Nov 12 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: newmans | last post by:
Perhaps one of the experts can straighten me out on this point... In Bjarne Stroustrup's book 'The C++ Programming Language' 3rd Edition, section 4.9, indicates that typedef complex<short>...
5
by: Minti | last post by:
How do we initialize static const data in C++, I tried class Foo { static const std::string name = "MyName"; }; I don't see any reason as to why this must not work.
24
by: Steven T. Hatton | last post by:
In the following code, at what point is S::c fully defined? #include <iostream> using std::cout; using std::endl; using std::ostream; class C { int _v;
8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
19
by: J. J. Farrell | last post by:
After many years of dealing with definition and linkage issues in ways that I know to be safe, I've decided it's time to try to understand this area properly. Consider a header file with the file...
10
by: Kobu | last post by:
My question is about the use and meaning of the terms "declaration" and "definition" as it pertains to the C language. I've read sources that mix the two up when talking about such things as...
9
by: Jess | last post by:
Hello, I was told that if I declare a static class constant like this: class A{ static const int x = 10; }; then the above statement is a declaration rather than a definition. As I've...
15
by: vaib | last post by:
hi to all.i'd like to know the actual difference between variable declaration and definition.it would be very helpful if anyone out there wud help me out with this thing.i'm writing here after here...
4
by: subramanian100in | last post by:
Consider the following: Class Test { public: Test(Test_int arg) : val(arg) { } typedef int Test_int; private:
15
by: akomiakov | last post by:
Is there a technical reason why one can't initialize a cost static non- integral data member in a class?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.