On 24 maalis, 21:03, "Alok Kumar" void myfn() { char a = 'A'; char b[2]; strcpy(b, &a); > } > Would I always get 'A' in b[0] and '\0' in b[1] after the strcpy? Not likely. 'A' is not terminated by NULL byte. It's just a char constant. If you would put it like this: #include void ...
First, please excuse any format errors and common mistakes. I'm new to C. If this is covered in the FAQ, my apologies. I couldn't find help for this particular problem. I'm sure it's relatively simple, but I've been pulling my hair out for about a day now, so any help is much appreciated. I'm using an fgets to read from a ...
Well, you could have tested it out to see if it worked... then you would have your answer. But the answer is yes, you can typecast variables in the arguments of functions. I am not sure if your specific example works, because I have never done that before. But it looks fine to me. If it was in your friends code ...