Computer Sciences > Gate 2017 Set-1 > String
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 _________.
#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("%dn", len);
}
void main()
{
char *x = "abc";
char *y = "defgh";
printlength(x, y);
}
#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("%dn", 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 _________.
Correct : 3
Similar Questions
A palindrome is a word that reads the same forwards and backwards. In a game
of words, a player has the following two plates painted with letters.
From...
Which number does not belong in the series below?
2, 5, 10, 17, 26, 37, 50, 64
Choose the word that is opposite in meaning to the word “coherent”.
Total Unique Visitors
Loading......