mikeage.net Logo
mikeage.net/2006/10/06/multiple-pointer-declarations/

mikeage.net @ כ״ד אלול תש״ע

Multiple Pointer Declarations

Quick quiz:

What does the following code do:

char* p1, p2

?

Hopefully, you recognized that despite the fact that the asterisk is attached to the word char, we're NOT creating two character pointers. Instead, we've created one pointer (p1) and one char variable (p2). Thus, the following are legal:

*p1 = 'C';
p2 = 'd';
p1 = &p2;
p1 = malloc(10*sizeof(char));

Leave a Reply

Quick Map
Content +
Personal +
Archives +
Site Stuff +
RBS Weather +
Search +
Recent Images
Visitors
Clustermap

Valid XHTML 1.1!
Printer Friendly Page
 

Last Modified: September 04, 2006 @ 02:11 CST

Memory(TRUE): 3407872/3407872
Memory(FALSE): 3171260/3212916