December 28th, 2012, 11:37 AM
I am unable 2 understand the following programs and their output.. can u pls help..
printf("I hate C");
printf("I love C");
char *p="hai friends",*p1;
December 28th, 2012, 03:05 PM
These programs are useful for obfuscation contests. Don't write like this. Take #4.
Per my understanding, c evaluates pointer[integer] as
Addition commutes, (a+b) == (b+a)
hence you can write
But please don't, your fellow programmers aren't likely to think that way.
a[i] is an integer, giving
a is a pointer
a[i][a] looks valid to me.
#1, I'd have to build and run, otherwise I'd have to spend maybe hours studying IEEE floating point. The key is to investigate number representations and what happens as the compiler casts through successive types. Again, that's part of the c standard.
#3, study precedence and left-to-right versus right-to-left order of operation. Don't write code like that!
#2, study the man pages for printf.
[/code] are essential for python code and Makefiles!