406 views

1 Answer

0 votes
0 votes

both are correct.and Output -0 (why)

printf("%d",strlen(c+2[p]-6[p]-1));

c=means array address.

2[p]=p[2]=T(element at p[2])

6[p]=p[6]=2(element at p[6])

ASCII value of T is 84 & ASCII value of 2 is 50.

c + 2[p] - 6[p] -1

 =c + 'T' - '2' - 1

= c + 14 - 1

= c + 13

(The C library function size_t strlen(const char *str) computes the length of the string str up to, but not including the terminating null character.)

strlen(c+33)

=0(it point to outside bounds of constant string)

Related questions

0 votes
0 votes
3 answers
1
radha gogia asked Jul 17, 2015
974 views
If we talk about that since since we cant access any random element in a linked list for that reason quick sort cant be used for linked lists ,then in merge sort also we ...
0 votes
0 votes
2 answers
4
Mak Indus asked Nov 10, 2018
282 views
Given an array of distinct integers A[1, 2,…n]. Find the tightest upper bound to check the existence of any index i for which A[i]= i.(a) O (1) ...