Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5430 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there, I am currently only just starting to learn C++. I have come upon a point where I need something explaining, Say I assigned variables like so: #include <iostream.h> int main () { int n, x; n = 30; int y=30; x = 30; return 0; } Now basically I just wondered whether that above will of assigned 30 ? (bytes :S) to each n, y and x. Sorry for the stupid question it is just I really want to gain a full understanding before I proceed.

Share this post

Link to post
Share on other sites
Basic questions, for example, concerning how variables work should probably be asked in the beginners forum.

For a start use this:

#include <iostream>
using namespace std;
instead of
#include <iostream.h>

iostream.h has been superseded by iostream.

n = 30; // Assignment of 30
int y = 30; // Initialization of y with 30
x = 30; // Assignment of 30

Try adding the line
cout << "n : " << n << endl;

That will soon tell you what value n is.

If you don''t already have it, get a book on C++. Failing that (due to financial constraints, or otherwise), there''s plenty of resources on the web.

Good luck,

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!