Shouldn't the sizeof operator return a value 27 in the function generate?
When I use the sizeof(space) in main() it returns 27. Why does it change to 4 when I do the same?
That means if I need the size of the array in the other function, I'm gonna have to calculate it in the main and pass it as a second parameter, right? But that isn't too flexible. Is there another method?
And, also, isn't size of a char* equal to 1B? Why does it say 4?
Well, you could end the charSpace[] array with a 0, then you could simply loop through until you find the 0. I think this is called Null-terminated.
I am pretty sure null-terminated means ending with a '\0' character or NULL character. Anyway, that is a good way, too. But i guess I will make do with passing the size as argument, for now.
Uh, no. You are printing the character '0' and not the character whose ascii value is 0.
Oh I'm sorry, I thought you were talking about the character '0'. My bad...
And yeah, @Bazzy! Always grateful to you. I always like the way you explain the things inside out. Learnt quite a few things from you.