Consider the following C program.
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 ________.
c
Programming in CData Types, Syntax, Control Structures, LoopsNAT2 marksHard
1#include <stdio.h>
2#include <string.h>
3void printlength (char *s, char *t) {
4 unsigned int c = 0;
5 int len = ((strlen(s) - strlen(t)) > c) ? strlen(s): strlen(t);
6 printf("%d\n", len);
7}
8void main ( ) {
9 char *x = "abc";
10 char *y = "defgh";
11 printlength (x, y);
12}
13A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.