#define CHARPTR char*
The C preprocessor expands the above code to the following.
But we would like p2 to be a character pointer but not a character variable.
So macro are not generally used for variable type definitions as they are not suitable for all sorts of usages. Instead typedef is used as shown below.
typedef char* CHARPTR;
With the above code, the variables p1 and p2 will effectively become character pointers.
Similar logic can be used to test if a particular enornviment variable is set or not. All enornviment variables are directly accessible in a bash script as variables. For example, if you need value of HOME enornviment variable, you can directly refer $HOME in the bash shell script.
Username or E-Mail
Lost your password?
Username or E-mail: