Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Also I would recommend, to cast pointer type that you allocate. Calloc, Malloc, Realloc <- all of this returns void pointer type to allocated memory.
A nice first challange to undestand how CodeWars works! Thanks
this is undefined behavior, the most dreaded aspect of C.
Anything can happen if you write beyond the bonds of a buffer. Your program could crash. Or you could be overwriting other variables. Or something else.
It depends on the platform, the state of the program, how variables were allocated (stack, heap,
.data
section,.rodata
section ...), and many other factorsCan anyone explain me why this happens when you declare this in C-
char *string = malloc(sizeof(char));
this should technically create a string of size 1;
but it doesn't,
this is able to store strings upto 30+ characters somehow, why is this happening /where am I wrong?
This comment is hidden because it contains spoiler information about the solution
devagya, please use spoiler flag next time.
It can be, but plenty of compilers will optimize a divide-by-two into a shift anyway. (Specifically any divide-by-power-of-two can be turned into a single shift)
Yes, bit operating is faster
This comment is hidden because it contains spoiler information about the solution
test gives out triangles like (12, 47, 21)
just google for "ASCII character code", for example 'A' has ASCII value of 65.