Question
C PROGRAM NEED SAME OUTPUT DONOT GIVE WRONG OUTPUT 1 - WAP to implement getword function Description: int getword(char *word) Create a function named getword.
C PROGRAM NEED SAME OUTPUT DONOT GIVE WRONG OUTPUT
1 - WAP to implement getword function
Description:
int getword(char *word)
Create a function named getword.
Function will receive the string from main
Function should return the length of the first word.
Pr-requisites:-
Functions
Pointers
Objective: -
To understand the concept of
Functions and Pointers
Inputs: - String Sample execution: - Test Case 1: Enter the string : Welcome to Emertxe You entered Welcome and the length is 7 Test Case 2: Enter the string : Hello
You entered Hello and the length is 5
REQUESTED FILE
#include
int getword(char str[]);
int main() { int len = 0; char str[100];
printf("Enter the string : "); scanf(" %[^ ]", str);
len = getword(str);
printf("You entered %s and the length is %d ", str, len); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started