[ create a new paste ] login | about

Link: http://codepad.org/rHZfjxgD    [ raw code | output | fork ]

nel - C, pasted on Oct 10:
#include <stdio.h>

int main(void)
{
	int temp[5] = {5, 20, 31, 11, 8};
	int *ptr;

	ptr = &temp[0]; // ptr points to the first element of 'temp'

	printf("ptr (clean): %d", *ptr);

	// let's math

	ptr+=2;

	printf("\nptr (ptr++): %d", *ptr);

	// more math

	(*ptr)++;

	printf("\nptr ((*ptr)++): %d", *ptr);

	return 0;
}


Output:
1
2
3
ptr (clean): 5
ptr (ptr++): 31
ptr ((*ptr)++): 32


Create a new paste based on this one


Comments: