[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Very basic

> char a[] ="abcdef";
> printf("%u\n",a);
> what is the "cout" equivalent of the second statement ?
> do reply (offlist if you so wish)
correct me some1 if i am wrong, imho it shud be:

cout << (unsigned int) ((char *) a) << "\n";

Actually this is another very stupid question, which examiners shud try to
avoid. The printf statement  can have many meanings, depending on the
sizeof(char *) and what the contents of the stack are, and hence basically
the architecture of the system. Under MSDOS this wud give different types of
output depending on the memory model used to compile the program! Output of
this program is of course not guranteed to anything beyond

    /\ |\/| |3 /\ r