Sure, you know C ?

2 views
Skip to first unread message

Viral Mehta

unread,
Jul 15, 2016, 8:05:58 AM7/15/16
to fundamental...@googlegroups.com
What will be the output of following ?

ind:~/sample_prgs$ cat preced.c
#include <stdio.h>

int main () {
        int p = 0;

        p ? p += 1: p += 2;

        printf("%d", p);
}


--
Thanks,
Viral Mehta

Vishal Thanki

unread,
Jul 16, 2016, 4:53:36 AM7/16/16
to fundamental...@googlegroups.com
I would rather opt for a cleaner code rather than relying on compiler
to surprise me:

http://c-faq.com/expr/ternprec.html
http://c-faq.com/expr/seqpoints.html

I think I should have add email signature stating that "I use C but I
don't _know_ it"
> --
> -- Owner of this group do not accept ANY liability for the views expressed
> in the email or for the consequences of any computer viruses that may be
> transmitted with this email. Owner is not responsible for any kind of
> copyright violations or infringements caused/posted by any user of the
> group. Messages are posted through moderation also does not include any kind
> of verification against copyright violations or infringements.
> ---
> You received this message because you are subscribed to the Google Groups
> "insane" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to fundamental-discu...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Viral Mehta

unread,
Jul 16, 2016, 5:31:12 AM7/16/16
to fundamental...@googlegroups.com
Ha ha ha :)
You can write cleaner code but if you are looking at someone's code, you need to read it ;)

Love the signature, no C questions please
--
Thanks,
Viral Mehta

Vishal Thanki

unread,
Jul 17, 2016, 7:08:57 AM7/17/16
to fundamental...@googlegroups.com
If that code is part of NFS implementation in kernel, it is a good
idea to submit a patch ;-)
Reply all
Reply to author
Forward
0 new messages