I am using char array to store data when using fscanf function, as there is no space to malloc the char* before the function. However, I need it to be pointer for next function as the input is set as char pointer. How can I do it?
(Does it actually make sense?)
If foo
is of type char[n]
for integral n
, then you can use
&foo[0]
to give you the pointer to the zeroth element of foo
. The type of this expression is char*
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.