| www.delorie.com/archives/browse.cgi | search |
| Message-ID: | <35D14F56.585429A6@megalink.net> |
| From: | Chris Bill <chrisb AT megalink DOT net> |
| MIME-Version: | 1.0 |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Pointers |
| References: | <3 DOT 0 DOT 5 DOT 32 DOT 19980811191017 DOT 00825ec0 AT mail DOT geocities DOT com> |
| Lines: | 28 |
| Date: | Wed, 12 Aug 1998 08:16:23 +0000 |
| NNTP-Posting-Host: | 208.148.249.218 |
| NNTP-Posting-Date: | Wed, 12 Aug 1998 04:12:19 EDT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
John Meyer wrote:
> Okay, could somebody tell me a practical use of pointers once and for all?
> I am banging my head against the monitor trying to figure out what the heck
> pointers are good for.
How about dynamic memory allocation!?:
int *integerPtr = new int[10];
Or, searching for a character in a string:
char *aString = "Hello!";
char *ptr = aString;
while( *ptr ) {
if( *ptr == 'e' )
printf("Found the letter 'e'!\n");
ptr++;
}
I hope this is all you need to keep you from banging your head against
the monitor :)
Regards,
Chris Bill
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |