#include #include
void main()
{ void writing();
char buffer[520];
/*
How can I put the function writing()
in the buffer?
is it -> *buffer = &writing;
or -> &buffer = &writing;
????
*/
}
void writing()
{ printf("This is a test");
}
/*
Thanks,
Valentino
*/
Comments
: #include
: void main()
: { void writing();
: char buffer[520];
:
: /*
: How can I put the function writing()
: in the buffer?
: is it -> *buffer = &writing;
: or -> &buffer = &writing;
: ????
: */
: }
: void writing()
: { printf("This is a test");
: }
: /*
: Thanks,
: Valentino
: */
You can't put a function in a string buffer !!
Perhaps you want to make a pointer on this function in order to use it ?
Declaration of the pointer:
type_returned_by_the_function (*name_of_the_pointer)(type_of_the_parameters_of_the_function);
In this case:
void main()
{
void (*fct)(); // Declaration of the pointer
fct=writing; // The pointer is set on writing
fct(); // => use writing
/* if you have a second function e.g. writing2() */
fct=writing2; // Then the pointer is set on writing2
fct(); // use writing2
}
I should have known that but I forgot