606 views

1 Answer

0 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 

Position:
Show:

Related questions

0 0 votes
0 0 answers
1.2k
1.2k views
abhinowKatore asked Dec 5, 2022
1,236 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 0 votes
2 2 answers
816
816 views
0 0 votes
3 3 answers
2.7k
2.7k views
Aibi asked Oct 30, 2017
2,706 views
Consider the following program segmentint main(){char *str = "GATECS";printf("%d", madeeasy(str));return 0;}int madeeasy(int *p1){int *p2 = p1;while(*++p1);return p1-p2;}...
0 0 votes
0 0 answers
471
471 views