I know that when passing strings between functions
char *str is almost the same as char str[n] in function header.
However i do wanna know why this would work and whats the difference between these 2 when working with string
I found that if i declare a “char *in” first then assign a string to it “in=string;”
this wont work
can some one tell me whats behind this?
Is there anyway I can assign a array to another array? like in Java
Thanks
char[] one;
char[] two={'a','b'};
one=two;
The syntax is wrong. This isn’t Java.
This works because array decays to a pointer.
NO. Arrays and pointers are two different concepts. They both aren’t the same.