Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 Jun 2012
Offline Last Active Jun 26 2012 11:06 AM

Posts I've Made

In Topic: ? about arrays

26 June 2012 - 10:29 AM

You can access the elements of an array is a second way aswell.

[source lang="cpp"]int array[10]; // create the arrayint *p = array; // create a pointer of the same type and assign it to the start of the array.[/source]

Now, using pointer arithmetics, you can access the elements by adding a number to the pointer, such as "p+1", which is the same thing as array[1]. "p" by itself would be the same thing as array[0]. This actually what arrays do, but I think the compiler keeps a note on how many elements the array was created with, to help you with not going out of bounds.
Also, you need to "delete" arrays that have been created with "new" by typing "delete[]".

Pointer ariothmetics is not just an alternative way of traversing an array, but is something more or less needed, so it's good to know it.

I'm a bit rusty on programming atm, so don't bash me too hard if I wrote something stupid or made some silly mistake.

EDIT: oh, and using an array normally (array[0]) dereferences automatically, but if you use "p", it's not dereferenced, so you need to write "*p" to get the actual value of the element, instead of the address to it. Just wanted to point that out, even if I felt it was obvious.

In Topic: total noob here. Can you recommend a c++ compiler?

26 June 2012 - 10:22 AM

This is known as an IDE. A compiler just takes the name of a file and makes an exe, it doesnt include an editor. For Windows the best IDEs are Visual Studio (which is made by Microsoft), Code::Blocks, and Eclipse. I don't know about eclipse but I know Visual Studio and Code::Blocks include a compiler with them. Id recommend you download Visual Studio 2010 Express edition to start.
Alternately, there are lots of text editors that you can code in, such as Notepad++ which you can also configure to run a compiler, or even just open a command prompt to run the compiler from

Dev-C++ is at least as good as Code::Blocks, I would say. Definitely better than Eclipse in my opinion. So ye, I recommend Dev-C++ if you, like me, think Visual Studio feels too cumbersome.

In Topic: Textured meshes don't look as they should?

25 June 2012 - 11:22 PM

I know why! Because when maya repeats textures, it only works in maya. To repeat textures, you should change the actual UV layout. Maya does something internally which is not exported.

That is, assuming you're repeating using the attributes in the window/sidebar to the right. If you repeat the texture in the UV editor, by scaling your UV's up, it'll work, assuming there's nothing else wrong.

In Topic: Best 3d modelling software for beginners?

25 June 2012 - 11:19 PM

There used to be a great little program called "Nendo", which I started with some 10 years ago. Not sure it even exists anymore, but it sure was lovely to work with. It really felt like sculpting, for some reason.

In Topic: Newbie

24 June 2012 - 01:01 PM

In every search that i do everybody says that's is not important to know C in order to learn C++.

Its not, they're different languages, knowing one of them makes learning the other easier since they are related but learning one in order to learn the other is counterproductive.

When looking at books and stuff, they often say you don't need to know C to learn C++, and I think that's the kind of thing he, or they, meant, because they're all-inclusive (EDIT: I mean, the book teaches everything without need for prior knowledge) . But the difference between C and C++ really is pretty small (compare C to QBasic and the difference is bigger), so if you learn C++, you know a lot (if not most) of C, for example. If you already know C, then moving to C++ is only a little more than an adjustment. (Not trying to understate the difference, because there sure is a difference, but the difference is small for beginners, I think we can agree.)

So, yes it is counter-productive to learn C before you learn C++, if you think about it, but it's not useless to do so. I don't see a reson to downvote what Simon said, because technically he's right.