--- In [email protected], "Dipak Gaigole" <[EMAIL PROTECTED]> wrote:
>
> On 6/16/07, rahul chaudhary <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > ranjan kumar ojha <[EMAIL PROTECTED]
> > <cool_ranjan4all%40yahoo.com>> wrote:
> > #include<cstdio>
> > int main()
> > {
> > char *s="\12345s\n";
> > print("%d",sizeof(s));
> > return 0;
> > }
> >
> > what will be output of above program and why ????
> >
> > hi friend,
> > your program will give error because you declare a pointer as
> > trying to assign a value to a pointer at the declaration time.
> > its not valid and acceptable in C
> >
> No, thats not the cause of error.
> We can initialize a char pointer with a constant string.
> It is valid and acceptable in C.
> 
> Dipak

That's correct.
The only thing that g++ complained about on my Linux installation was
that "print()" is not declared in <cstdio>. Ranjan, I suppose you
probably meant to utilise "printf()" here, am I right?

Nonetheless you should have tried yourself before asking us what the
response might be.

Regards,
Nico

Reply via email to