#include <stdio.h>
#include <stdlib.h>
/* pointers and strings, a love story...
/* this shows how a string can be displayed
/* by using pointers to the characters in the string
/* to dance through the array and display it's contents. */
int main()
{
/* declare a string */
char string[] = "The name of the band is Grateful Dead.";
/* declare a pointer to the string
/* which is really a character array with an NULL ('\0')
/* character at the end. */
char *string_ptr;
/* initialize the pointer */
string_ptr = string;
/* start marching through the array */
while(*string_ptr != '\0')
{
/* show what's at the address */
/* display it then skip to next address */
putchar(*string_ptr++);
}
printf("\n\n");
system("PAUSE");
return 0;
}
:: Top ::