Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program ? #include<stdio.h> int main() { char str1[] = "Hello"; char str2[] = "Hello"; if(str1 == str2) printf("Equal\n"); else printf("Unequal\n"); return 0; } ?->(Show Answer!)
1. What will be the output of the program ? #include<stdio.h> int main() { char str1[] = "Hello"; char str2[] = "Hello"; if(str1 == str2) printf("Equal\n"); else printf("Unequal\n"); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.02 pm
Step 1: char str1[] = "Hello"; The variable str1 is declared as an array of characters and initialized with a string "Hello". Step 2: char str2[] = "Hello"; The variable str2 is declared as an array of characters and initialized with a string "Hello". We have use strcmp(s1,s2) function to compare strings. Step 3: if(str1 == str2) here the address of str1 and str2 are compared. The address of both variable is not same. Hence the if condition is failed. Step 4: At the else part it prints "Unequal".