#Whats wrong ???

42 messages · Page 1 of 1 (latest)

covert burrowBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

pulsar zodiac
#

The Q : To change letters from uppercase to lower case

topaz rock
#

The char letter; is creating a new uninitialized variable, shadowing the argument name

#

Basically delete line 6

pulsar zodiac
#

now ???

topaz rock
#

Question: what should to lower return if you pass a lowercase letter?

pulsar zodiac
#

-1

#

crct ??

topaz rock
#

This isn't a correct or not, this is a question of design.
If I run your code and type b what do you think it should print

pulsar zodiac
#

-1

#

because anything other than capital letter should return -1

topaz rock
#

Then check the return value, if it's negative, print -1, otherwise print the character (%c to print characters in C)

pulsar zodiac
#

ahh i did not get it

#

BTW you gained a sub

topaz rock
#

Cool

#

So in these kind of scenarios, the best way to help is to give us a sample input, what the expected output is and what your program is currently outputting

pulsar zodiac
#

okay ...

#

Now i am getting this

#

the ASCII value of letters rather than the lower letters

#

what to do???

topaz rock
#

%c to print characters instead of %d

pulsar zodiac
#

noo that is crct

#

right??

mortal kraken
#

crct?

pulsar zodiac
#

yahh

mortal kraken
#

What does that mean

pulsar zodiac
#

%d is used for numbers

#

%c is used for characters

mortal kraken
#

signed integers

pulsar zodiac
#

right???

#

%f for float integers

#

thats how it is done righhtt

topaz rock
#

That's good yep 👍

#

In the final line, you are using %d

pulsar zodiac
#

ahh thanks

#

just noticed

#

thank you sooo much

#

it worked

#

uffff

covert burrowBOT
#

@pulsar zodiac

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.