I've specified the function definition in the header file (strv.h):
void strRev(char* theString);
Here is my function:
#include "strv.h"
void strRev(char* theString){
char *pEnd = theString;
char temp;
while (*pEnd) pEnd++;
pEnd--;
while (theString < pEnd) {
temp = *pEnd;
*pEnd-- = *theString;
*theString++ = temp;
}
}
Now, I'm trying to call this from main, but getting an error:
#include "strv.h"
#include <iostream.h>
void main(){
char sArr[7] = "abcdef";
strRev(&sArr[0]);
cout<<sArr<<endl;
}
I'm getting the following error:
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Str2.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
What is this??
You can create new project of type "Console Application" and paste this code to it.