Question: C Programming HOMEWORK HELP!!! I want to ask a user: How many sentences you wish to enter but I want the max to be 10,

C Programming HOMEWORK HELP!!!

I want to ask a user: "How many sentences you wish to enter" but I want the max to be 10, or produce error if number is higher than 10 and try again

How do I do this? Can you help me?

-----------------------------------------------------------------------

#include #include

int main(){

char **mySen; int numSentences;

scanf("%d", &numSentences);

printf("You have put in %d.", numSentences);

mySen= (char **)malloc(numSentences*sizeof(char *));

int i;

for(i=0;i

printf("Enter Sentence #%d: ",(i+1)); mySen[i] = (char *)malloc(100*sizeof(char));

scanf(" %[^ ]s", mySen[i]);

}

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!