Pointer and Array
Pointer
What is Pointer?
Pointer is a variable that store the value of another variable. Basically, a pointer isvariable that points at another variable when it is called, hence the name "Pointer".How to use it?
It's rather easy to use pointer.int a;
int *pointer;
*pointer = &a;
Notice the difference? that's right a pointer use '*' before the variable and the designated variable needs '&' as it is a symbol for the address of a variable.
"But can i point a pointer using a pointer?"
Well folks you're in luck because fortunately we could point a pointer with another pointer.
int a;
int *pointer;
int **point;
*pointer = &a;
**point = &pointer;
to point another pointer we could just put another '*' behind the variable
but wait,
WHAT'S THE LIMIT?
My friend, the limit is your imagination so use as many pointers as you want
Array
What is an Array?
Array is structures of data grouped together, just think of it as a single box that contains other boxes with a single data in them.but remember
ARRAY STARTS FROM ZERO
so a 12 characters string would be
char word[13] = {'H','e','l','l','o','','W','o','r','l','d','!','\0'};
"Hey I saw the word "string" in there what is it?"
a string is an array of characters that ended with '\0' or what we call NULL.
You can manipulate string easily in C especially with the library string.h.
That's all folks no more
Comments
Post a Comment