Pointer and Array
Meaning of Pointer
A variable that store the address of another variable
Two operators mostly used in pointer :
- · * (Content of)
So the (*) symbol in (*ptr) for example is
used to point the content in ptr variable
- · & (Address of)
The (&) symbol in (ptr = &x) is
used to show where the x address is
Pointer to Pointer (**)
A variable that saves another address of a pointer
So when the second pointer get the address of the first pointer
using the (&) symbol, it ( the second pointer ) can point the content of
that address using the (**) symbol.
Meaning of Array
A series of elements of the
same type placed in contiguous memory locations that can be individually
referenced by adding an index to a unique identifier
• Syntax:
type array_value [value_dim];
• Example :
int A[10];
Two Dimensional Array
•
Syntax
2D Array:
type name_array[row][col];
•
Example:
int a[2][0];
String
An array of character
that ended with a null character ( ‘\0’ )
• Example :
char
s [ ] = ”Makan”;
Similar to :
char s[ ] = {’M’,’a’,’k’,’a’,’n’,’\0’};
The fuction to manipulate string is ( #include<string.h> )
Comments
Post a Comment