stirng difference in ascii code negative doubt.Not able to store negative integers in char and not able to print the character array as well…I am printing the differnce but not ablle to find the error in program
Stirng difference in ascii code negative number doubt
Hi @piyush.bansal8158625, when you obtain a difference between any i and i+1 characters then you have to inser the difference b/w those 2 values. Here what u are doing is when you obtain a difference, you store it and print the character corresponding to that value. For example if string given is acb, then:
ascii© - aascii(a) = 2.
you should print a2c…, but you program will print that character who’s ascii value is 2, b/w ‘a’ and ‘c’.
So, what you have to do is print the difference as it is, without doing anything to it, w.r.t. to chars.
Hope this helps
Ya i got it.I got the question wrong. Still if i want to modify the original array how is it possible