arrays...

Frank Swarbrick swarbric at tramp.Colorado.EDU
Mon May 2 07:51:16 AEST 1988


Is there some reason why you can do:

void foo(const int *bar);

main()
{
   int ary[] = {1,2,3,4};

   foo(ary);
}

but you can't do

void foo(const int *bar);

main()
{
   foo({1,2,3,4});
}

Never mind that it seems silly to do this particular thing without any other
parameters.  I was just too lazy to write in the other ones.  This is even
stranger concidering you *can* do

main()
{
   char str[20];

   strcpy(str,"This sucks!");
}

(no,
 strcpy(str,{'T','h','i','s',' ','s','u','c','k','s','\0'});
doesn't work....)

Frank Swarbrick (and his cat)           swarbric at tramp.Colorado.EDU
...!{ncar|nbires}!boulder!tramp!swarbric
"The shifting shafts of shining weave the fabric of their dreams..."



More information about the Comp.lang.c mailing list