[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] gets strengen



> Jeg burde ikke være oppe nu, men jeg kan ikke sove fordi jeg skal flyve til
> Frankrig i (dag) morgen kl 0700, men det er nok mere afsnit 6.2 du skal
> kigge på. Det har lidt at gøre med hvad compileren gør når du skriver char
> *a, og når du skriver char a[]. Det er ikke helt det samme sted de to peger.
> Men læs selv i ovennævnte afsnit.

Det er korrekt, men det var nu heller ikke det vi diskuterede ;)

Det jeg siger er, at a er en pointer når: 
char a[300];

Du kan prøve følgende lille test:
	char hej[7];

	hej[0]=0;
	hej[1]=1;
	hej[2]=2;
	hej[3]=3;
	hej[4]=4;
	hej[5]=5;
	hej[6]=6;

	printf("%d %d\n",hej,&hej[0]);	
	printf("%d %d\n",hej+3,&hej[3]);
	printf("%d %d\n",*(hej+3),hej[3]);

Som du kan se, så opfatter kompileren "hej" som en pointer til et array.
Det er forkert at sige, at "hej" ér et array;)

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *