Try this: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int x = atoi(argv[1]); int y = 10; x = (x > 10) ? y++: 10; return x; } Wladimir Araujo Tavares *Federal University of Ceará
* On Fri, Jun 24, 2011 at 12:40 AM, Vishal Thanki <vishaltha...@gmail.com>wrote: > Hey all, > > I think I am missing something very basic in C, and which is troubling > me. Following code is not compiling for me, can anyone explain why? > > vishal@ubuntu:~/progs/c\ 09:07:01 AM >$ cat ternary.c > #include <stdio.h> > #include <stdlib.h> > int main(int argc, char *argv[]) > { > int x = atoi(argv[1]); > int y = 10; > (x > 10) ? y++: x = 10; > return x; > } > vishal@ubuntu:~/progs/c\ 09:07:08 AM >$ gcc ternary.c > ternary.c: In function ‘main’: > ternary.c:7: error: lvalue required as left operand of assignment > > > Vishal > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.