C Programming - Strings - Discussion
|
|
|
|
Read more:"Two things are infinite: the universe and human stupidity; and I'm not sure about the universe."
- Albert Einstein
|
| 1. |
Which of the following statements are correct about the program below?
#include<stdio.h>
int main()
{
char str[20], *s;
printf("Enter a string\n");
scanf("%s", str);
s=str;
while(*s != '\0')
{
if(*s >= 97 && *s <= 122)
*s = *s-32;
s++;
}
printf("%s",str);
return 0;
}
|
| [A]. |
The code converts a string in to an integer | | [B]. |
The code converts lower case character to upper case | | [C]. |
The code converts upper case character to lower case | | [D]. |
Error in code |
Answer: Option E
Explanation:
This program converts the given string to upper case string.
Output:
Enter a string: indiabix
INDIABIX
|
|
Varad Salvi said:
(Sun, Jun 26, 2011 09:47:11 PM)
|
|
| |
| Perfect form 1 to 100. |
|
|