C: Ponteiro para string

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

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#include <stdio.h>
#include <string.h>
 
int main(void)
{
	char s[11];
	int i;
	char *p=s;
 
	printf("%p (p)==%p (s)\n",p,s);
	printf("%p (&p)==%p (&s)\n",&p,&s);
 
	scanf("%s",s);
 
	for(i=0;i<strlen(s);i++)
		printf("%c",*(p+i));
	return 0;
}