The syntax error has already been pointed out in the comments. Also, as it has been mentioned, you never reset i
after for
loop, which prevents your while
loop from running.
However, you have to also take in mind that this
char test[] = "";
allocates array test
of only 1 character long. You cannot put more than one character of data into that array. In other words, your storeArraysintoStruct
is sure to overrun the array and fall into undefined behavior territory.
In you want to preallocate a larger buffer for future use in storeArraysintoStruct
, you have to specify the size explicitly. For example
char test[1000] = "";
will make test
an array of 1000 characters. Of course, regardless of how large the array is, it is your responsibility to observe the size limit.
P.S. What is the point of that parameter a
, if you never use it inside storeArraysintoStruct
?
2
solved I am getting C++ syntax error [closed]