C: Ponteiro para array

From AdonaiMedrado.Pro.Br
Revision as of 01:45, 17 April 2009 by Adonaimedrado (Talk | contribs)

Jump to: navigation, search
#include <stdio.h>
#define TAMANHO_VETOR 10
 
int main(void)
{
	int v[TAMANHO_VETOR];
	int i;
	int *p=v;
 
	printf("%p (p)==%p (v)\n",p,v);
	printf("%p (&p)==%p (&v)\n",&p,&v);
 
	for(i=0;i<TAMANHO_VETOR;i++)
		scanf("%d",v+i);
	for(i=0;i<TAMANHO_VETOR;i++)
		printf("%d\n",*(p+i));
	return 0;
}