C++Guns – RoboBlog

31.07.2012

fucking C Part 2

Filed under: Allgemein — Tags: — Thomas @ 18:07

Part 1


int array[2][2]={{0,1}, {2,3}};
printf("element: %i\n",  *(  *( array + (0,1)) + (0,1) ) ) ;


kater@ktux:~$ bin/gcc/bin/gcc -Wall test.c
test.c: In function ‘main’:
test.c:87:43: warning: left-hand operand of comma expression has no effect [-Wunused-value]
test.c:87:52: warning: left-hand operand of comma expression has no effect [-Wunused-value]

Welche Zahl wird ausgegeben? 0, 1, 2 oder 3?
Tipp 1:
Der erste *operator entscheidet ob man in {0,1} oder {2,3} Array landet. Der zweite *operator entscheidet dann zwischen der 0, 1 bzw 2,3.

Tipp 2:
a = (1,2); wird zu a = 2;

Thx @BjoernC

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress