What is the output of the following code?#include <stdio.h>int main() { char str1[] = "abc"; char str2[] = "abc"; if (str1 == str2) { printf("Equal\n"); } else { printf("Not Equal\n"); } return 0;}
Question
What is the output of the following code?#include <stdio.h>int main() { char str1[] = "abc"; char str2[] = "abc"; if (str1 == str2) { printf("Equal\n"); } else { printf("Not Equal\n"); } return 0;}
Solution
The output of the code will be "Not Equal".
Here's why:
In C, when you compare two arrays (like str1
Similar Questions
What will be the output of the following code snippet?
What is the output of the following code in Python?
What will be the output of the following C code?
What is the output for the following code?Note: This question helps in clearing conceptual technical interviews for service-based companies.
What will be the output of the following C++ code?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.