70 votes 70 votes Consider the following C program. #include<stdio.h> #include<string.h> int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; } The output of the program is _______ Programming in C gatecse-2017-set2 programming-in-c numerical-answers array pointers + – Madhav asked Feb 14, 2017 • edited Jan 13, 2023 by shadymademe Madhav 28.7k views answer comment Share Follow See all 12 Comments See all 12 12 Comments reply Show 9 previous comments Shubhamishere commented Jun 27, 2023 reply Follow Share Please note here that you don’t really need to remember the ASCII values of T or I. Why? Because you just have to know the number of alphabetical difference between the two characters T & I. The difference is simply 11 (you can even count it on your fingers). Assuming A → 1; B → 2; C → 3;….. Z → 26 I.e; what’s the difference between G & D ? ‘G’ – ‘D’: 7 – 4 = 3 This intuition would come in handy in the exam environment. 2 votes 2 votes himanshud2611 commented Jan 28 reply Follow Share Key concepts to note: 2[p] = *[p+2] = p[2] 6[p] = *[p+6] = p[6] %s of (c+10) is 17, strlen in int will be 2. 0 votes 0 votes ritiksri8 commented Mar 25 reply Follow Share assume starting address as 100 100+(84-73-1)=100+10=110 after which two characters are there resulting in the length of 2. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes 1st concept is -Strlen does not count null pointer . Now strlen(17) is 2. B Bhatta answered Feb 28 B Bhatta comment Share Follow See all 0 reply Please log in or register to add a comment.