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
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
Get step-by-step solutions from verified subject matter experts
