Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Code Example:
int x = 7; // integer x contains value '7'
int *xp; // declares xp as a pointer to
// an integer
#include <stdio.h>
Char *SkipFirst( char string[]){
Return string+1;
}
Void main() {
char word[] = "array";
char str*;
str = SkipFirst( word );
Puts( str ); // outputs 'rray'
}
ePublicist.ca © 2007, 2008, 2009
Dynamic Memory Allocation
void main()
{
int toal, *ap;
int total = 50;
ap = (int *)malloc( total * sizeof(int));
if(ap ==NULL) {
printf("Failed to allocate memory...\n");
return;
}
}
ePublicist.ca © 2007, 2008, 2009
Pointers to structs
(*bkptr).speed = 10;
bkptr->speed = 10;
ePublicist.ca © 2007, 2008, 2009
Summary