int a=0,b=2;
if (a=0)
b=0;
else
b=*10;
What is the value of b ?
Answers were Sorted based on User's Feedback
Answer / kc
The code will not compile as statement "b=*10" is invalid"
It should be "b*=10".
If i assume "b*=10" then the output will be 20
Reason:
a=0;
b=2;
if(a=0 means 0) so b=0 will not execute
b=b*10=2=10=20;
Is This Answer Correct ? | 37 Yes | 6 No |
Answer / akash
The value of b will be 20.
Because when a=0 is presented in if condition, it will take it as false condition. So the else block will execute.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / kishore sharma
a=0;
b=2;
but
condition
if(a=0)(b=0)
so
b=*10;
answer is
b=b*10 (b=0)
b=0*10;
0
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sandeep kumar
if (a=0)
is a wrong statement.
Since it should be
if (a==0)
so, it will throw an error
Is This Answer Correct ? | 0 Yes | 1 No |
Can we change the value of constant variable in c?
How can I discover how many arguments a function was actually called with?
Write a program to reverse a given number in c?
struct node {struct node*temp,*new} prinf("%d",sizeof(struct node));
Describe advantages and disadvantages of the various stock sorting algorithms
print the table 5 in loops
count the numbers between 100 and 300, that star with 2 and ends with 2
how many keywords do C compile?
7 Answers Microsoft, Practical Viva Questions,
write a program to display the array elements in reverse order in c language
What is variable in c with example?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What does the c preprocessor do?