Welcome, Guest. Please login or register.

Author Topic: Mr. Biehl learns C  (Read 7205 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline woof

  • Jr. Member
  • **
  • Join Date: Feb 2003
  • Posts: 94
    • Show all replies
    • http://uae.is.free.fr
Re: Mr. Biehl learns C
« on: April 18, 2005, 08:33:48 PM »
Just consider pointers as arrays ;-)
As  with a pointer like
char *tab;
char c;
you can do *tab=c; or the SAME tab[0]=c; so a pointer is an (unknown size) "array"

If your pointer ("array") come from a malloc() it give
you access to a block ("array") of memory

If it is the screen data pointer = it is an array of pixel
tab[320*3+64]=0; can set up as black the (x 64 y 3) pixel of a 256  colors screen ("array" of pixels)

If it is a string pointer so can change chars
tab[0]='H'; tab[1]='E'; tab[2]='L'; tab[3]='L'; tab[4]='O'; tab[5]=0; ("array" of chars)


Alain
 :-D