main()
{
int i = 1;
int num[] = {1,2,3,4};
num[i] = i++;
printf("%d", num[i]);
}
what will be the output?
}
Answer Posted / tk
Answer is :: 3
Explanation::
main()
{
int i = 1;
int num[] = {1,2,3,4};
num[i] = i++; // Here i = 1, so num[1] = 1; and num =
{1,1,3,4}
// After the execution of this statement the value of i
will be 2 (as i++)
printf("%d", num[i]); // num[2] = 3 so answer is 3
}
}
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is main () in c language?
How can I convert a number to a string?
What is the difference between malloc() and calloc() function in c language?
Can you subtract pointers from each other? Why would you?
How can you convert integers to binary or hexadecimal?
Write a program for Overriding.
Why is c called c not d or e?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What is the advantage of a random access file?
How can I pad a string to a known length?
What Is The Difference Between Null And Void Pointer?
Explain how does flowchart help in writing a program?
What is the c language function prototype?
What is the use of pragma in embedded c?
When do we get logical errors?