+ 1

Help me out in solving (solved)

char str[] = "%d %c",arr[]="sololearn"; printf(str,0[arr],2[arr+3]); https://www.sololearn.com/post/460421/?ref=app

8th Jul 2020, 1:20 PM
Santosh Chavan
Santosh  Chavan - avatar
10 ответов
+ 2
0[arr] is same as arr[0] which value here is 's' ; Initially arr points to start or 0th element of array. And arr+3 means arr [say location is 1000] pointer added 3 positions farward, now points to arr pointer points to arr[3] [location is 1003] which is 'o'. (note array points from 0 index). Now 2[arr] means arr[2], and the value is 'e'. [Since now start position is arr+3 is arr[0] that is 'o'. So] And in printf %d coverts charecter value to ascci or numaric value of 's' which is 115. So Output is 115 e. Hope it clears you...
8th Jul 2020, 1:38 PM
Jayakrishna 🇮🇳
+ 10
Santosh Chavan 0[arr] and arr[0] both representing the zeroth index in this index value is S capital S and ASCII value of capital S is 83 so it will be 83 and the ASCII value of small s is 115 . Hope you understood.
8th Jul 2020, 2:26 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
It's the same as; char arr[] = "Sololearn"; printf("%d %c", arr[0], arr[5]); Outputs 83 e 83 is the int value of 'S'
8th Jul 2020, 1:33 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Here's an ascii chart. Look at the values in the Dec (base 10) ("%d") column, under the section printable characters, for the characters. Capital letters starting at 'A' with the value of 65, increasing by 1 in alphabetical order, range from 65-90. Lower case letters are +32 of their upper case counterparts, and range from 'a' 97 to 'z' 122. https://www.ascii-code.com/
8th Jul 2020, 1:50 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
83 for 'S' 115 for 's'
8th Jul 2020, 1:41 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Santosh Chavan if it is small s in sololearn, Output is 115. If capital S as SoloLearn then output is 83. The ascii values of respected characters.
8th Jul 2020, 1:42 PM
Jayakrishna 🇮🇳
+ 1
Thanks a lot Jayakrishna🇮🇳 ChaoticDawg 😊😊
8th Jul 2020, 1:47 PM
Santosh Chavan
Santosh  Chavan - avatar
+ 1
See here Santosh Chavan Just remember 'A' - 'Z' is 65 to 65+25=90 And 'a' to 'z' is 97 to 97+25=122 https://ascii.cl/index.htm?content=mobile You're Wel come
8th Jul 2020, 1:51 PM
Jayakrishna 🇮🇳
0
ChaoticDawg do you mean 0[arr]=arr[0]? and how is s value equals 83?
8th Jul 2020, 1:35 PM
Santosh Chavan
Santosh  Chavan - avatar
8th Jul 2020, 2:32 PM
Santosh Chavan
Santosh  Chavan - avatar