The output of the above code is HalloBye..But I am not able to debug it..I know that ternary has precedence over comma operator but i am stuck at which operand will go with which operator..Can someone please help
@Moschops thanks for your explaination..but I have a doubt that since the order of evaluation is left to right then according to it ternary should execute first printing Hallo then comma should execute evaluating the expression n==5?printf("Hallo"):printf("Hai") again printing hallo and then lastly Bye..So the output must beHalloHalloByeCan you please explain is this logic correct??
Why do you think this: n==5?printf("Hallo"):printf("Hai") should be evaluated twice?
One time for the ternary operator coz ternary executes first and second for the comma operator as it will also evaluate the expression on its left which is n==5?printf("Hallo"):printf("Hai") the braces from my point of view must be as
((n==5?printf("Hallo"):printf("Hai")),(printf("Bye"))) is it correct?
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...