there is a way to make a pointer and then edit the content of what that pointer points to using a function:
void func (char *p)
p[index_of_element] = 'A';
ptr =(char *) malloc (size_of_an_element * number_of_elements);
// content of what ptr points to is now changed and can be used normally
that would be using a dynamic allocation and last post wasnt quite dynamical allocation but creating an array in function and then saving it using return.
Yes, that is easily possible. Just use a pointer to a pointer.
Basically, in the same way a pointer can "point" to a piece of memory that holds some data (like an int or a char), a pointer can "point" to another pointer. Basically, you pass a pointer to a pointer as an argument to the function, and you dereference that crazy thing to get a plain old pointer. The cool thing is that it *will* change the original pointer. (This craziness is required for the same reason you can't just modify non-array data passed as parameters.)
Here's an example of a function that would allocate memory for a char pointer.
void alloc_char(char **cp)
*cp = (char *)malloc(sizeof(char));
int main(int argc, char *argv)
/* We pass the address of the pointer so that we can modify the original copy! */
alloc_char(&my_char); // &my_char is a char **
/* Don't forget to free! */
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...