Difference between revisions of "C: Ponteiro para array"

From AdonaiMedrado.Pro.Br
Jump to: navigation, search
(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=...)
(No difference)

Revision as of 01:29, 17 April 2009

#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;
}