Nico Heinze wrote: > --- In [email protected], Knowledge Seeker > <[EMAIL PROTECTED]> wrote: > >> There will be no output ... as your program will fail to compile !! >> >> ranjan kumar ojha wrote: >> >>> #include<cstdio> >>> int main() >>> { >>> char *s="\12345s\n"; >>> print("%d",sizeof(s)); >>> return 0; >>> } >>> >>> what will be output of above program and why ???? >>> > > KnowledgeSeeker, > if you're complaining about the "return o" instead of "return 0" or > the "#include <cstdio>", you're of course correct, but this won't help > Ranjan anyway. > > No offense intended Nico, but what i wanted to convey to OP is that he has not even taken any pains to try the problem first hand. The groups is for help and not for spoon-feeding.
> Ranjan, > that depends on the OS you work with and the compiler. Under VMS and > Windows as well as most Linux installations and many Unix systems, you > will most probably get a response of 4; under MS-DOS you might get a 2 > or a 4, depending on the compiler. > On many Unix systems and some Linux and Windows installations you will > probably get a 8 printed out. > > Why do you ask? > Why haven't _you_ told us what you expect the output to be? > Is this kind of a joke or interview question? > Is it meant to see how carefully we read the question (as "sizeof( > char*)" is printed, not "sizeof (char [])")? > Or in order to see how well we care for knowledge about the standard > library? > > Regards, > Nico > > >
