0

char=l;
string='hello';
This is my input,The particular character present in the string to change lower letter to upper letter.
Output: heLLo

Please anybody help me;

3
Contributors
6
Replies
8
Views
5 Years
Discussion Span
Last Post by WaltP
1

We don't do homework here. If you want help, you'll need to provide more than just program requirements.

Votes + Comments
Indeed
0
#include<stdio.h>
#include<ctype.h>
void main()
{
 char str[20],a;      int i;
scanf("%s",str);
printf("Enter the char\n\t");
scanf("%c",a);
for(i=0;str[i]<=10;i++)
{
if(str[i]==a)
{
 printf("%c",toupper(str[i]));
 }
 else
 {
 printf("%c",str[i]);
 }
 }
 }

This is my code and i tried my possible ways of trouble shoot ot make it work; but i fails. I am getting an message stating "NULL POINTER ASSIGNMENT" :( ... please just trigger me the right way to get out of this issue..

Thanks in advance!

Edited by Narue: Added code tags...not that it helped. :P

0

please just trigger me the right way to get out of this issue..

Look closely at your second call to scanf().

0

Thanks for your suggestion..Now i am not getting any error message. But still i am failing to get the output! i feel the code not event enter into the for loop. what i have done wrong ?

0

i got it where i made a mistake.. the problem was on for loop.. :) i fixed it... my last question. after my task done it also returns some junk value like some different symbols how to avoid it?

0

after my task done it also returns some junk value like some different symbols how to avoid it?

Don't know. We are unable to see your code as it is now, we don't know what your input was, we don't know what your output was.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.