I am writing a C program and because there is no string in C, I wrote the following code to work around:
typedef char * string
now I need a array of strings and the following statement gives me an error:
string * file1
the error message says:
Error 1 error C2275: 'string' : illegal use of this type as an expression \\vmware-host\shared folders\school\misc\johncpp\porj\similarity.c 79
im on MSVC compiler
can I not create an array of strings which is essentially char **?
thanks
As @Oli suggests in his comment, you probably don’t really want to do it at all. Assuming you put some semicolons in the right spots, your code is legal C, however. It must be something special about MSVC that’s giving you an error. Are you sure nothing else in your compilation unit is named
string?Edit: A quick check at this link indicates you might just be declaring the variable someplace you’re not allowed to – it has to be at the top of a block or outside of all blocks (i.e., a global variable).