C: Ponteiro para array

From AdonaiMedrado.Pro.Br
Revision as of 01:29, 17 April 2009 by Adonaimedrado (Talk | contribs) (New page: <code lang="c"> #include <stdio.h> #define TAMANHO_VETOR 10 int main(void) { int v[10]; int i; int *p=v; printf("%p (p)==%p (v)\n",p,v); printf("%p (&p)==%p (&v)\n",&p,&v); for(i=...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#include <stdio.h>
#define TAMANHO_VETOR 10
 
int main(void)
{
	int v[10];
	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;
}