GATE CS 2017, set 1 · Question 53 · Programming and Data Structures · Numerical answer (NAT) · 2 marks · no negative marks
Consider the following C program.
#include <stdio.h> #include <string.h> void printlength(char *s, char *t) unsigned int c = 0; int len = ((strlen(s) - strlen(t)) > c) ? strlen(s): strlen(t); printf("%d ", len); void main() char *x = "abc"; char *y = "defgh"; printlength(x,y);
Recall that strlen is defined in string.h as returning a value of type size_t, which is an unsigned int. The output of the program is ______.
Answer
Answer 3
Answer from the official GATE CS 2017 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes