Question: It is C code. There are bugs in it. Please explain me what is wrong and how to fix it Header file C file main.c

It is C code. There are bugs in it.

Please explain me what is wrong and how to fix it

Header file

It is C code. There are bugs in it. Please explain mewhat is wrong and how to fix it Header file C filemain.c stringhelp.h \#pragma once \#ifndef STRINGHELP_H \#define STRINGHELP_H \#define MAX_STRING_SIZE 511 \#define

C file

MAX_INDEX_SIZE 100 \#define MAX_WORD_SIZE 23 struct StringIndex \{ char str[MAX_STRING_SIZE +1]; intwordStarts[MAX_INDEX_SIZE]; int lineStarts[MAX_INDEX_SIZE]; int numberStarts[MAX_INDEX_SIZE]; int numWords, numLines, numNumbers; \} ; /* Return the index of the next whitespace. * @param str -the string to search * areturns the index of the next white

main.c

space or the position of the string terminator. *) int nextWhite(const char*str); * @param word - where the result will be placed *

stringhelp.h \#pragma once \#ifndef STRINGHELP_H \#define STRINGHELP_H \#define MAX_STRING_SIZE 511 \#define MAX_INDEX_SIZE 100 \#define MAX_WORD_SIZE 23 struct StringIndex \{ char str[MAX_STRING_SIZE +1]; int wordStarts[MAX_INDEX_SIZE]; int lineStarts[MAX_INDEX_SIZE]; int numberStarts[MAX_INDEX_SIZE]; int numWords, numLines, numNumbers; \} ; / * Return the index of the next whitespace. * @param str - the string to search * areturns the index of the next white space or the position of the string terminator. *) int nextWhite(const char* str); * @param word - where the result will be placed * aparam idx - the index to use * aparam wordNum - the index of the number to retrieve * areturns the number or an empty string if index is invalid */ void getNumber(char word[], const struct StringIndex* idx, int numberNum); /** * Return a pointer to the start of a line * aparam idx - the index to use * aparam lineNum - the index of the line to retrieve * areturns a pointer to the start of the line */ char* getLine(struct stringIndex* idx, int lineNum); /** * Prints characters until the terminator is found. * @param s - the string to print * aparam start the index to start printing * aparam terminator - the character to stop printing at when encountered. */ void printUntil(const char* s, const int start, const char terminator); /** * Prints characters until a space is found. * aparam s - the string to print * aparam start - the index to start printing */ void printUntilspace(const char* s, const int start); \#endif stringhelp.c \#define _CRT_SECURE_NO_WARNINGS \#include "stringhelp.h" \#include \#include \#include int nextWhite(const char* str) inti,result=1; for (i=0;result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!