#include <stdio.h>

main()

{

char * str = "hello";

char * ptr = str;

char least = 127;

while (*ptr++)

least = (*ptr<least ) ?*ptr :least;

printf("%d",least);

}



#include <stdio.h> main() { char * str = "hello"; ..

Answer / susie

Answer :

0

Explanation:

After ‘ptr’ reaches the end of the string the value pointed
by ‘str’ is ‘\0’. So the value of ‘str’ is less than that of
‘least’. So the value of ‘least’ finally is 0.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  


find simple interest & compund interest

2 Answers  


main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }

2 Answers  


how to delete an element in an array

2 Answers   IBM,






what is oop?

3 Answers  


How to count a sum, when the numbers are read from stdin and stored into a structure?

1 Answers  


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


main() { char *p = "hello world"; p[0] = 'H'; printf("%s", p); } a. Runtime error. b. “Hello world” c. Compile error d. “hello world”

5 Answers   HCL,


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


Derive expression for converting RGB color parameters to HSV values

1 Answers  


main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }

1 Answers  


Categories