The C standard says no such thing; only integer promotions are performed. (See 6.5.2.2 of the C99 final draft.)

Ok one more question. Why does this not give a warning then (and runs fine)?


#include <stdio.h>
struct Hello {
       char world[20];
};
struct Hello s(){
       struct Hello r;
       r.world[0]='H';
       r.world[1]='\0';
       return r;
}

int main(){
       struct Hello a;
       a=s();
       printf("%s\n",a.world);
       return 0;
}

In this case an implicit conversion of char[] to (char *) is happening as well as far as I can see.

Regards,
Michel


Reply via email to