Difference Between The Lines

I want to make sure I understand the difference in the lines

Page 1 of 1

1 Replies - 743 Views - Last Post: 23 January 2008 - 08:41 PM Rate Topic: -----

#1 soccerizzy26  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 69
  • Joined: 23-January 08

Difference Between The Lines

Post icon  Posted 23 January 2008 - 07:01 PM

This is my first post and I understand that this website isn't here to do my homework but I'm taking my class online and do not have a teacher in person who I can ask questions so I'm hoping someone on here can help me.

One of the questions for my assignment is to explain each line given to me and explain the difference between each line. I'm going to print out the lines then my explaination of each and their differences and if you find anything wrong or something I left out if you told me that'd be great.

a. int x;
b. int x = 3;
c. x = 3;

I believe line a x is an int variable and the value has not been declared yet
In line b the x is still an int variable but the value has been declared and it is equal to 3
In line c the type of variable isnt declared but it would be called x and equal to 3

The difference between the lines is that a is missing a value, line b is complete, and c is missing the type of variable

Is This A Good Question/Topic? 0
  • +

Replies To: Difference Between The Lines

#2 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Difference Between The Lines

Posted 23 January 2008 - 08:41 PM

IIRC "declaring" a variable is when you say int x;, definining it is when you give it a value. Other than that, it all looks fine (as long as you know that all of those are valid in certain situations). :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1