Code koans for C? [closed] - c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Is there a Code Koans Set for C or Lisp?
I've found Koans in this languages, but no one in C or Lisp:
Ruby: http://rubykoans.com/
JavaScript: https://github.com/mrdavidlaing/javascript-koans
Clojure: https://github.com/functional-koans/clojure-koans
Scala: https://github.com/rubbish/scala-koans

May the following apocryphal stories and parables from the heyday of UNIX, C and LISP bring you some fun and enlightenment.
AI koans
Rootless root

They exist for Lisp now but not yet for C. There are C++ Koans though:
Lisp Koans
C++ Koans

Related

Why can't I use the ^ operator in C? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
Is the ^ operator available in the C language? I have tried using it but it gives a faulty output.
Does it denote raising an integer to the power of something
It works just fine and means bitwise XOR. That is, 1^2 gives 3.
Unfortunately C doesn't provide a function to take power of integers. This is a known flaw of the language. You have to roll out such a function yourself either by using multiplication in a loop, or use the slow floating point function pow.

Is there any random number generator in C other than rand()? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to generate random numbers in C which are extremely random. Is there any other function than rand()? I am using windows and gcc compiler. If it is from any other library, please mention the header file.
yes
you can use arc4random(). This will give you more random number than rand().
The mersenne twister is considered a good RNG. Good randomness, fast but it can be predictable if you don't take steps.
Here you can find some versions:
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/C-LANG/c-lang.html
No. There is no other function in standard C to generate random number other than rand(). GCC provide rand_r() function as an extension.

CRC ECMA-182 reference [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I would like to cross check a C implementation of the CRC64 ECMA-182 algorithm.
I tried a different C code snippet I found online and I tried two online CRC calculators but each of them returned different results.
Is there some reference implementation or reference data that allows me to get a reliable reference checksum?
The EMBL-EBI web site has an online checksum calculator, that is used in the context of bioinformatics for analysing protein or genome sequences:
http://www.ebi.ac.uk/Tools/so/seqcksum/
that supports many different methods, included the CRC64-ECMA-182. You can paste your input sequence directly in the form and it will return the checksum. The problem is that the input is a sequence must be one from a set of fixed formats:
http://www.ebi.ac.uk/Tools/so/seqcksum/help/index.html#sequence
However those formats are quite simple, for example the FASTA (link)

How to get a list of C code functions ordered by length? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm analyzing a big chunk of C code and would like to split it into modules. Is there a way to automatically generate a list of C functions, starting with the ones that are the longest?
With the GNU userland (e.g. on Linux) you can use nm -S --size-sort object.o to get a list of symbols sorted by size from an object file. This should be approximately proportional to source code length.
If we can assume that the line with a function declaration is not indented, ends with { and the function definition ends with a non-indented }, this Python snippet can help:
#!/usr/bin/python
import sys
started = None
started_line = None
for lineno, line in enumerate(sys.stdin):
if line.startswith(' '):
continue
if line.strip().endswith('{'):
started = lineno
started_line = line.rstrip()
if line.strip().endswith('}'):
print("%s\t%s" % (lineno - started, started_line))

Tool to explain C code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I remember from some time ago reading about a commandline tool that explains C code, does anyone know what it might be named?
Perhaps you mean cdecl, a program that can translate complicated declarations to English and back?
e.g.
cdecl> explain int (*(*foo)(int ))(float )
declare foo as pointer to function (int) returning pointer to function (float) returning int
If you mean explaining then I think the answers already been given. If you mean looking for potential problems then there's lint and its variants, first stop in any code review.
http://en.wikipedia.org/wiki/Lint_programming_tool
Edit:
C/C++ Free alternative to Lint?
HTH

Resources