Message from C, C++ discussions

November 2019

— Okay

— 

ArrayData choose_Array_Member_Amount(InitialQuestionP Choose){

int ArrayMemberTotal;
int blue;
StringorInt choice = Choose();
ArrayData Array_Data;//1
Array_Data.chooseStringorInt = choice;

clearScreen();
switch(choice){

case INTEGAR:
puts("How many members do you need in your Integer Array?\n");
break;

case aSTRING:
puts("How many members do you need in your String Array?\n");
break;
}

blue = scanf(" %d", &ArrayMemberTotal);

switch(blue){


case 1:
Array_Data.ArrayMemberTotal = ArrayMemberTotal;
return Array_Data;
break;


default:
break;
}
}

— This is an function with the return type of a structure i created

— The parameter is a typedef to a function

— Pointer

— It calls that function and stores what that function returns which is an enumeration symbol i created , either aSTRING or INTEGAR

Message permanent page

— Based on those options, it will print one of two statements

— Then it scanf for a variable called ArrayMemberTotal , if you put in an int like 2 , 4 , or something like that it works fine

Message permanent page

— But lets say there is an error on the user end, i want it to print a timed error message(i have a function that does that ) then re ask the qestions until and scan again

Message permanent page

— I tryed goto and it doesnt do what i am trying to do

— Goto statement is only useful and must only be used for cleanup and not for retry

— So in this case what would be a good way to deal with this issue