How do you declare an array of three pointers to chars?
How do you declare an array of three char pointers?
Note: both of these questions are merely alternative wordings for the same question.
char * a[3];
How do you declare a pointer to an array of three chars?
char a[3]; // an array of three chars
char * p = a; // a pointer to an array of three chars
How do you declare a pointer to a function which receives an int pointer?
#include
// some functions we can point at:
void func_1(int * p){}
void func_2(int * p){}
// note: all functions we wish to point at with the same
// pointer must have the same signature.
int main()
{
int* p = NULL; // instantiate an int pointer
void (*pFunc) (int*); // declare a function pointer
pFunc = func_1; // point to func_1
pFunc(p); // call func_1 via function pointer
pFunc = func_2; // point to func_2
pFunc(p); // call func_2 via function pointer
return(0);
}
Note that the brackets in the function pointer declaration are required. If you omit them, you will end up with a standard function declaration that returns a pointer to void, resulting in a compiler error.
// declare a function int* function(int, int); or int* (function)(int, int); // declare a pointer to a function int* (*pointer_to_function)(int, int);
You don't declare library functions. Simply include conio.h. For details use the built-in help.
if u declare variable in method & tray to use this variable outside the method then it is out of scope
To scope class members to the class (rather than to instances of the class), declare them as static members of the class. Static members are accessible even when no instances of the class exist. As such, static member functions do not have access to a 'this' pointer, unlike ordinary (nonstatic) member functions.
yes, we can not declare a function in the body of another function. but if we declare a function in the body of another function then we can call that very function only in that particular function in which it is declared; and that declared function is not known to other functions present in your programme. So if a function is required in almost all functions of your programme so you must declare it outside the main function i.e in the beginning of your programme.
// declare a function int* function(int, int); or int* (function)(int, int); // declare a pointer to a function int* (*pointer_to_function)(int, int);
char *p="ragav"
datatype function_name() { }
public void throwRock() { }
You don't declare library functions. Simply include conio.h. For details use the built-in help.
The doctor determines if a patient has a pulse, if the patient are breathing and if he or she has any brain functions. If all three bodily functions are absent,a doctor can declare the person dead.
if u declare variable in method & tray to use this variable outside the method then it is out of scope
To scope class members to the class (rather than to instances of the class), declare them as static members of the class. Static members are accessible even when no instances of the class exist. As such, static member functions do not have access to a 'this' pointer, unlike ordinary (nonstatic) member functions.
They declare library functions They contain macro definitions They contain type definitions
yes, we can not declare a function in the body of another function. but if we declare a function in the body of another function then we can call that very function only in that particular function in which it is declared; and that declared function is not known to other functions present in your programme. So if a function is required in almost all functions of your programme so you must declare it outside the main function i.e in the beginning of your programme.
It used to be a good question 30 years ago. Right know you don't have to know anything about near and far pointers; but if you still use a 16-bit compiler, select 'Large Model' (or 'Huge Model'), and forget 'near' and 'far'
When we declare an array of characters it has to be terminated by the NULL , but termination by NULL in case of string is automatic.