+ 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

10 Answers

+ 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...

+ 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.

+ 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'

+ 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/

+ 2

83 for 'S' 115 for 's'

+ 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.

+ 1

Thanks a lot Jayakrishna🇮🇳 ChaoticDawg 😊😊

+ 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

0

ChaoticDawg do you mean 0[arr]=arr[0]?
and how is s value equals 83?

0

Thanks 🐍Sizuna 🐉