edited by
28,672 views
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 _______

edited by

13 Answers

0 votes
0 votes
1st concept is -Strlen does not count null pointer .

Now strlen(17) is 2.
Answer:

Related questions

31 votes
31 votes
11 answers
13
Madhav asked Feb 14, 2017
9,802 views
Consider the following function implemented in C:void printxy(int x, int y) { int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf(“%d, %d”, x, y); }The output of invoking $...
25 votes
25 votes
7 answers
14
Madhav asked Feb 14, 2017
12,168 views
Consider the following C program.#include<stdio.h int main () { int m=10; int n, n1; n=++m; n1=m++; n ; n1; n-=n1; printf(“%d”, n); return 0; }The output of the prog...
26 votes
26 votes
3 answers
16
khushtak asked Feb 14, 2017
5,886 views
Match the following:$$\begin{array}{|ll|ll|}\hline P. & \text{static char var ;} & \text{i.} & \text{Sequence of memory locations to store addresses} \\\hline Q. & \text...