Thread: i need help with a dinamic matrix

  1. #1
    Registered User madsmile's Avatar
    Join Date
    Feb 2002
    Posts
    26

    i need help with a dinamic matrix

    Sorry i know this is a stupid question but i don't know how to do this...


    i need to create a dinamic matrix to capture some pixels of the screen...

    i want something like this (i know this code doesn't work)

    void capture_matrix (int x, int y)
    {

    int m[][] = new m[x][y] sizeof (int)

    /*
    the rest of my code
    */
    }

    how can i do that???? i really need to do that for capture a matrix of pixeles with getpixel(); it is for capture first a small matrix, then draw something over that and then restore the matrix with putpixel(m[cx][cy])
    MADSmile
    ICQ #3653692
    (i'm running Borlad C++ Ver 3.1 under MSDOS)

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > int m[][] = new m[x][y] sizeof (int)

    This is not C. THis is an attempt at C++.
    You are on the C board. Go to the C++ board.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User madsmile's Avatar
    Join Date
    Feb 2002
    Posts
    26
    wost... i still don't know the diference between c and c++ sorry..
    MADSmile
    ICQ #3653692
    (i'm running Borlad C++ Ver 3.1 under MSDOS)

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    28
    one...pick up a book on either C OR C++ and read up on 'em...

    anything u can do in C u can do in C++ but no the other way around.

    C uses malloc, realloc (i think) and free to handle dynamic memory.

    C++ uses new and delete...

    if ur using new u dont need sizeof btw.

    if ur using malloc u do need sizeof.

    pick a language then i can help u a bit more.
    curiousity killed the cat, but it
    makes for one hell of a programmer.

    Alien.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C - access violation
    By uber in forum C Programming
    Replies: 2
    Last Post: 07-08-2009, 01:30 PM
  2. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 05:57 PM
  3. Matrix and vector operations on computers
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM
  4. Matrix Reloaded Questions (SPOILERS_
    By Xei in forum A Brief History of Cprogramming.com
    Replies: 73
    Last Post: 10-19-2003, 02:21 PM