295 views

1 Answer

0 votes
0 votes

If this question from Ace Mock 7 then definitely it is a big mistake because answer should be -10

In this question we need Ascii table because for \n(new line) numeric  value is 10 https://www.techonthenet.com/ascii/chart.php

 now ++*p means value increment at the address so p points to address of \n value of \n is 10 after increment it becomes 11

now same ++*str1 gives 11 and ++*str1-32=-21

and ++*p+ + +*str1-32 gives us 11 + (-21)=-10

for more clearness see this.http://code.geeksforgeeks.org/3xeTyK 

Related questions

2 votes
2 votes
0 answers
1
Asim Abbas asked Jan 25, 2018
514 views
I am not able to solve this question. Please provide solution. Or is this question incorrect? Answer was given as (C)
0 votes
0 votes
0 answers
2
abhinowKatore asked Dec 5, 2022
639 views
What will be the return value of the below function, if it is called a sample(4)? int sample(int x){ if( x == 0 || x ==2) return 1; return (sample( x) * (x ));}
0 votes
0 votes
2 answers
3
0 votes
0 votes
3 answers
4