#include <stdio.h>
int main()
{
if ("X" <"x")
printf("X smaller than x
");
}


my question is whats the mistake in this program? find it and please tell me..

Answers were Sorted based on User's Feedback



#include <stdio.h> int main() { if ("X" <"x") printf("X sma..

Answer / sandeep

Friend
In c if we write string constants like "Hi" "Hello world"
etc,it will be just a poiinter unless u prints it.
So if pointer pointing "X" is greater "if will not be executed"
else if pointer pointing "x" is greater "if will be executed"

Is This Answer Correct ?    2 Yes 1 No

#include <stdio.h> int main() { if ("X" <"x") printf("X sma..

Answer / raisa

character X and x should always be enclosed in single quotes

Is This Answer Correct ?    0 Yes 0 No

#include <stdio.h> int main() { if ("X" <"x") printf("X sma..

Answer / preethi

#include <stdio.h>
void main()
{
int X,x;
if (X <x)
printf("X smaller than x");
}

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

What is logical error?

0 Answers  


Write a function that accepts a sentence as a parameter, and returns the same with each of its words reversed. The returned sentence should have 1 blank space between each pair of words. Demonstrate the usage of this function from a main program. Example: Parameter: “jack and jill went up a hill” Return Value: “kcaj dna llij tnew pu a llih”

5 Answers   Mind Tree,


enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

4 Answers   ME,


What is the difference between void main() and void main (void) give example programme?

0 Answers  


What are derived data types in c?

0 Answers  






how can i get the output 54321 4321 321 21 1 in c programming........???? pls help......

10 Answers   Infosys,


Between macros and functions,which is better to use and why?

0 Answers  


What are c header files?

0 Answers  


How are Structure passing and returning implemented by the complier?

0 Answers   TISL,


Can we change the value of #define in c?

0 Answers  


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

0 Answers  


x=2,y=6,z=6 x=y==z; printf(%d",x)

13 Answers   Bharat, Cisco, HCL, TCS,


Categories