BinaryByter
my unit tests take AGES to compile
BinaryByter
is this okay?
olli
is this okay?
Personally I would not catch the polymorphic type by value
BinaryByter
Personally I would not catch the polymorphic type by value
IDC about what exception it is I just want to get a unit test failure when it occurs
BinaryByter
lol
olli
my opinion :D
BinaryByter
https://github.com/Wittmaxi/ZENeural/blob/master/library/tests/test_main.cpp
BinaryByter
rate my spageth that somebody toucha
BinaryByter
10/9
Ten outta nine or nine outta ten?
BinaryByter
If latter, how to improve?
BinaryByter
Im that good? :D
klimi
Sure
chandan
Hi
klimi
Hi
Anonymous
sure, thanks
LoneWolf
Hey guys.
LoneWolf
I need help with some doubts.
LoneWolf
I'm a complete beginner in programming, the language I'm using is C.
LoneWolf
So, I stumbled upon some pieces of code on stackexchange, which I couldn't understand.
LoneWolf
How the heck getchar() works, I'm having trouble finding some links which can explain me.
BinaryByter
BinaryByter
as defined by posix
LoneWolf
I'm on a very shitty smartphone. Do you want me to give you the link to stackexchange post or paste a pic of code from my notebook.
BinaryByter
send the link
BinaryByter
easiest
LoneWolf
former
Right now, it won't be possible because I unexpectedly lost power in the lab PC due to cut, and I have lost the link, sorry.
BinaryByter
lol okay
LoneWolf
But, I jotted it down anyways.
BinaryByter
jotted?
LoneWolf
easiest
Of course.
LoneWolf
jotted?
Wrote it down.
LoneWolf
Wait, let me write it nicely.
BinaryByter
Oggay :D
LoneWolf
Here's the code snippet.
LoneWolf
Today, I read up way too much code, I'm feeling sick now, I read up thing after thing, tried to solve too many doubts, my mind is screwed badly.
BinaryByter
Here's the code snippet.
this loop gets a char until it hits a "\n"
BinaryByter
when it does, it stops
LoneWolf
Here's the code snippet.
Now, what issue I'm facing/observing on execution.
BinaryByter
What is the issue you are facing?
LoneWolf
See, first of all, codeBlocks throws a "multiple character.... something" warning at compilation, which I ignored and when I entered a number , so that first while evaluates to false, it doesn't terminate(return 0).
BinaryByter
was the warning at the while loop?
BinaryByter
at the "\n"?
LoneWolf
Sorry, for delay, I have a very shitty smartphone, don't yet have a laptop and c is fun.
LoneWolf
Yes! Same line
BinaryByter
Yes! Same line
"\n" is a single character. thus you should use '\n'
LoneWolf
Second while loop to be exact.
BinaryByter
else it might be interpreted as a strinc
LoneWolf
BinaryByter
Here's the code snippet.
what do you want to achieve by this code?
BinaryByter
you prolly want something along the lines of this:
LoneWolf
"\n" is a single character. thus you should use '\n'
Oh, I did use single quotes in my code, just wrote wrong in the pic, sorry.
BinaryByter
char *getString () { char* tmp; char* tmp1; do { scanf ("%s", tmp); /*merge the two strings together*/ } while (tmp != '\n') return tmp1; }
LoneWolf
what do you want to achieve by this code?
I was trying to get my head around scanf and getchar(), so I have developed this bad habit of implementing new pieces of code from web while investigating my issues. So, I tried to implement this code, ran into the same doubts as the guy who asked it, now the power's gone.
BinaryByter
lol
BinaryByter
who are you learning programming for?
BinaryByter
if its not for uni, learn C++
BinaryByter
its just a lot easier
BinaryByter
while still being as powerful
BinaryByter
(if not ten thousand times more)
BinaryByter
doesnt scanf do that for ya?
BinaryByter
is it just me or does the C-stdlib mostly consist of very thin assembler syscall wrappers?
BinaryByter
isnt that php-mentality?
Ludovic 'Archivist'
olli
doesnt scanf do that for ya?
scanf does not allocate memory
olli
is there like any c-stdlib function that does allocate memory?
olli
besides the obvious malloc, realloc, calloc
Dima
you can write your own
LoneWolf
Actually, I'm pursuing Electronics engineering, frehman here, at a no name uni, I wanted to pursue CS but couldn't cut it, so here I'm wasting my freetime on learning c, because it's in our course too