![Neha](https://www.crazyengineers.com/img/avatar.jpg)
Member • Aug 14, 2006
Member • Aug 14, 2006
Member • Aug 15, 2006
Member • Aug 15, 2006
Member • Aug 15, 2006
Member • Aug 15, 2006
That's true. Infact both in C and C++ >> and << are bitwise-shift operators. In C++ these operators are overloaded to achieve redirection aswell. In C we don't have the concept of overloading of operators. So, we have to live with printf and scanf.nehaI agree they are used in C++ but they are used in C too and are better known as Bitwise Operators.
Member • Aug 15, 2006
Member • Aug 15, 2006
Member • Aug 16, 2006
Member • Aug 17, 2006
Member • Aug 17, 2006
Member • Aug 18, 2006
Member • Aug 18, 2006
Member • Aug 18, 2006
Member • Aug 18, 2006
Member • Aug 18, 2006
Referringsravikhi neha !
just forget bout tat. bcoz i am damn sure it will not give d result. u will get couple of errors on any C compiler.
CCS#3: Avoid slangs in posts. Also avoid placing dots in between words. Take your time to write ‘great’ instead of ‘gr8’. Please use good english. It creates a good impression.
Just forget about that. Because I am damn sure it will not give the result. You will get couple of errors on any C compiler.
Member • Aug 25, 2006
Member • Aug 25, 2006
Member • Nov 12, 2006
Member • Nov 13, 2006
Member • Nov 14, 2006
Member • Nov 14, 2006
no.MaheshHi aditi,
I think the solution is :
0
1
2
10
11
Is this correct?
Member • Nov 14, 2006
Member • Apr 30, 2009
Member • May 1, 2009
seeya302004, Sravik is correct. The program has syntax error. And the details you have provided does not hold true till program have syntax errors because with syntax error a program will not compile successfully and generate a executable.seeya302004Output of the following program is
Sorry Sravik! But i dont agree wid u,
Explanation: When the value of i=0, den it will certainly satisfy the check condition of for(i.e. i<20) so it will enter into the for loop den, since value of i=0, "case 0" statements will start executing.(i.e. i=i+5 or i=0+5 => i=5) now note dat there is no break statement after case 0 : i+=5;
=> no unconditional end of the switch (when break is encountered by the compiler it comes out of the immediate body(which is swich here) in which it is written n is "not mandatory" to write it after every case statement) now since no break is encountered the compiler will go on executing the follwing statements irrespectiv of the fact dat whether i value is satisfying the case condition or not
=>at case 1 :i becoms 7,den no break,=>at case 2: i becums 12 (no break) =>at default it becums 16.den break is encountered it will come out of the switch-body n will print the value of i which is 16, den it will increament its value by 1(for progression (i++))=>i=17 now.When it enters switch none of the case value matches wid value of i =>directly default statement will get executed => i = 17+4=21, again we found break => out of switch again ,print the value 21 n den increament its value by 1 i.e. i=22, but now the for condition which is i<20 is not satisfied hence program will get terminated...I hope u got it!
Member • May 1, 2009
main() { int *a, *s, i; s = a = (int *) malloc( 4 * sizeof(int)); for (i=0; i<4; i++) *(a+i) = i * 10; printf("%d\n", *s++); printf("%d\n", (*s)++); printf("%d\n", *s); printf("%d\n", *++s); printf("%d\n", ++*s); }will be:
reachrkataIs the answer :
0
11
10
20
21
Any reason for the output in C++ to be different than that of C? I feel the output should be same.bharathkumarpyour answer is exactly correct in c++ but not in c....
Member • May 3, 2009