I have work with 3 or 4 compiler. and both 32 bit and 64 bit OS. So we should consider this fact that result on a OS & compiler will differ from another OS/Compiler. This is C.
Type: Posts; User: piyush.sharma
I have work with 3 or 4 compiler. and both 32 bit and 64 bit OS. So we should consider this fact that result on a OS & compiler will differ from another OS/Compiler. This is C.
I think both are same, the difference should only be the number of bytes allocated.
What if you take a large size buffer that will be enough for storing tokens temporarily.
My idea is :
global buffer;
int functionToTokenize(char * str)
{
while()
{
I Agree, but i felt tough to express that code in words so I paste that one. I didn't find an option to delete that post to end that mistake.
Its sound bad and not a good impression if we write text...
What is plan after counting number of spaces ? If you don't want dynamic, how will you manage this with static (means if you have larger number of tokens) ?
Whats the issue if I cast malloc(). Mostly I have seen in examples, people cast the return value of malloc() because it returns (void *).
Ok !!! I will take care of it. Thanks to interrupt.
Its seems your homework. By the way, strings and its functions work with pointers. So if you have done it, you used pointers. To do this explicitly, (If you store input in a variable) initialize two...
This is an undefined behavior, so we can't predict the output. You can view this warning if you enable -pedantic flag of gcc.
ISO C90 forbids variable-size array ‘str’