Anonymous
Hmmm
frakw
this is a hanoi tower program, i want to use while(1) to run next turn ,how to use realloc in this program ? code:https://pastebin.com/Zqie9jsV test:https://repl.it/@frakw/He-Nei-Ta-hanoi
Anonymous
Does anyone have experience with _Generic
Anonymous
In C , to make use of something similar to Typeof that you would find in high level languages
olli
In C , to make use of something similar to Typeof that you would find in high level languages
Not sure what you want to do, but _Generic won't be able to support "polymorphic types" in contrast to the common GetType() functions of other languages
Anonymous
I read somewhere that you can use that with an enumeration to create something similar to Type dev
olli
So what exactly is it used for
Basically to support overloaded functions based on the type
Anonymous
Basically to support overloaded functions based on the type
Is there way to start a function over if it doesn’t meet certain conditions but not at the beginning like recursion like , a few lines into the function ?
Anonymous
Or maybe I am wrong
Anonymous
Call back?
I think a call back is used for something like qsort
Anonymous
Maybe idk
Anonymous
Yes in interrupts too
Anonymous
Ya
olli
Is there way to start a function over if it doesn’t meet certain conditions but not at the beginning like recursion like , a few lines into the function ?
Not sure what you are trying to do, but depending on the condition, make a call to another function If you need to check the same condition multiple times use a loop
Anonymous
Anonymous
Okay
Anonymous
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; } }
Anonymous
this is an function with the return type of a structure i created
Anonymous
the parameter is a typedef to a function
Anonymous
pointer
Anonymous
it calls that function and stores what that function returns which is an enumeration symbol i created , either aSTRING or INTEGAR
Anonymous
based on those options, it will print one of two statements
Anonymous
then it scanf for a variable called ArrayMemberTotal , if you put in an int like 2 , 4 , or something like that it works fine
Anonymous
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
Anonymous
i tryed goto and it doesnt do what i am trying to do
Anonymous
Goto statement is only useful and must only be used for cleanup and not for retry
Anonymous
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
Anonymous
the program otherwise works , but if there is an error on the user end , like entering an Letter instead of an number, it doesnt work
Anonymous
maybe 12 hours drive for me lol
Anonymous
Alright I got your program flow. What I need to understand now is that what error are you talking about? Are you talking about the error when a user enters some arbitrary character other than INTEGER or aSTRING?
Anonymous
Why?
Anonymous
Alright
Anonymous
so in this case what would be a good way to deal with this issue
While loop Dude, you are writing the same code for like a week
Anonymous
Put up a check for it before it goes into the switch
Anonymous
I give that a shot
Check in a while loop
Dima
Lol
Anonymous
That's hilarious 😂😁👍
its ok i am a beginner and i am not trying to rush
Anonymous
i want to fully grasp what i am doing before moving on
Anonymous
You've been told not to use goto But you keep doing it
Anonymous
Yes no worries
they been clowning me all week
Anonymous
Anonymous
and i fixed all the other issues , its just this last one
Anonymous
I doesn't work that way
so how does it work , o great ASCII gatekeeper
Anonymous
Yes no worries
thank you btw
Anonymous
I doesn't work that way
once i finish the book i want to do the three labs in the book , then read two more books , so i give my self to mid 2020 to get to this point
Anonymous
i am almost done with the 8th chapter in this 13 chapter book
Anonymous
You can understand some things only after a while You will be relearning the stuff you think you got Not rushing is good, but staying at one point for long time is not good either
Anonymous
You can understand some things only after a while You will be relearning the stuff you think you got Not rushing is good, but staying at one point for long time is not good either
so do you think i should stop this project and just finish the book, someone told me i need to be uploading stuff on github, so i figured i try to make this as good asa possible and put it up on githbub
Anonymous
Finish this damn project already😂
Anonymous
once i finish the book i want to do the three labs in the book , then read two more books , so i give my self to mid 2020 to get to this point
I think it is too slow Sometimes it is better to get more information and then filter that out, than trying to learn every possible word in a book
Anonymous
Finish this damn project already😂
i used loops to fix the other issues , this is actually a different issue , it works if users type in the correct input but lets say they put in a character and its scanning for an int i want to place an error message and ask the questions again
Anonymous
I think it is too slow Sometimes it is better to get more information and then filter that out, than trying to learn every possible word in a book
i thought learning was best via projects, i learnt alot doing this crappy project that was not in the book either from google, stackoverflow , or the great people of the chat
Anonymous
even trolls tossed a bone here and there
Anonymous
You good mate just carry on at your own pace if there isn't a time Constraint
Anonymous
You good mate just carry on at your own pace if there isn't a time Constraint
i needed to learn enough C to answer a question in this test i am taking but at this point i think i know enough to do that , so now i just learning because i want to build something with it at a later date
Anonymous
That's nice
Anonymous
/report
klimi
no you havent
Anonymous
if you see choose() nested in the loop returns a values that is passed in the first switch , depending on the value passed in that switch it ask one of two question , and the i set a variable to the scanf so i can tell if it accepting the right type of input
Anonymous
Oh I havent?
Anonymous
@K11M1 maybe a light warning
Anonymous
lol, you guys sometimes lay the hammer down to quickly , maybe refer him to the pinned rules
Anonymous
@K11M1
klimi
but which point of rules? spam?
klimi
offtopic?
Anonymous
offtopic?
idk i only seen one comment from him so idk how much damage he did , but i have seen some noobs in here get eliminated almost instantly lol