Jump to content

RobertBeic

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About RobertBeic

  • Rank
    Newbrie
  • Birthday 01/24/1988

Contact Methods

  • AIM
    RobertBeicLY
  • Website URL
    http://Rossia
  • ICQ
    Ekaterinburg
  • Yahoo
    143040
  • Jabber
    ivanovatopil@gmail.com
  • Skype
    RobertBeicLY

Profile Information

  • Gender
    Male
  • Location
    143040
  • Interests
    RobertBeicLY
  1. Function Pointers In A Structure

    I have a rough concept of being able to return a variable length array of pointers allocated by calloc with the data also allocated by calloc where the pointer list ends with NULL. So a could traverse the data and stop when it hits null, just like a string. But Im not 100 on how to dealloc the array of data yet, dealloc on the array of pointers 1 with last member = NULL seems easy enough. I guess maybe I could calloc each member of the array of data and use the pointer array to pass the right memory address to free. Then write a function to possible conveniently wrap this using type void and passing size_t. Then possibly wrapping the entire calloc bit into a similar type void function to easy the actual return of data. This seems obvious enough that I feel it has been done before. This is just a morph of the concept of returning a malloc allocated null-terminated string. The reason I want to do this is to be able to possibly return a set of matching points for geometry functions, where the number of points vertices maybe be anything from 0 matches to N matches. Will have to write and test this, but Im rather sure I can make this work. I do not like the idea I cannot return an array of unknown size in C. /End rant ...
×