User Profile

Collapse

Profile Sidebar

Collapse
Tomassus
Tomassus
Last Activity: Nov 24 '06, 05:43 PM
Joined: Nov 19 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Tomassus
    replied to Dynamic Array
    in C
    Hi there,

    You can't daclare something like:

    int x;
    cin >> x;
    int a[x];

    It won't compile because x is unknown in the time of compilation. Values in brackets while declaring arrays have to be daclered before compilation.

    U can try to declare 2-dimension array using new. Problem is that in C++ u can't declare 2-dimensional array directly.
    Example u can remake for...
    See more | Go to post

    Leave a comment:


  • Collection is a pointer to dynamic array of pointers to Objects - Items. I need it that way because i want to place all objects on the heap (not in the operational memory) and i want to be able to reallocate dynamically size of a table where i hold pointers to objects(collect ion).

    In constructor I'm declaring that variable for the first time - i forgot to copy/paste it.

    Code:
    t_Item::t_Item()
    {
    	liczba_item=0;
    ...
    See more | Go to post

    Leave a comment:


  • I will really really appreciate help in this task
    See more | Go to post

    Leave a comment:


  • Help me :)
    See more | Go to post

    Leave a comment:


  • Tomassus
    started a topic Dynamic memory allocation - memory corruption error
    in C

    Dynamic memory allocation - memory corruption error

    Hi there,

    I have a problem with dynamic memory allocation. I know that it would have been easier to use vectors methods, but i want to know what i do here wrong.

    This is one of my methods in t_Item class - I use it to store Item Objects (which are classes too).

    xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxx

    class t_Item {
    public:
    t_Item();
    Allocate_Item() ;

    private:...
    See more | Go to post
No activity results to display
Show More
Working...