I have these 2 simple codes that generate the same error message:
Pointer2 error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
Pointer2 is the name of the project that the code1 exists
For the second code (which is in another project) also generate the same message:
The codes:
Code:
#include <stdio.h>
void p2(){
char txt[20], *txtPtr;
printf("Enter txt: ");
scanf("%s",txt);
printf("\n\n");
txtPtr=&txt[0];
while(*txtPtr!=NULL){
printf("%c",*txtPtr);
txtPtr++;}
}
int main()
{
//p2();
int i,sum,x[3],*p;
sum=0;
printf("Enter 4 numbers");
for(i=0; i<=3; i++){scanf("%d",&x[i]);}
p=&x[0];//3 --
while(*p!=0){
sum+=*p;
//printf("%d ",*p);
p++;}
printf("The sum %d",sum);
}
-----------------------------------------------------------
Code:
#include <stdio.h>
int max2(int h[3]);
void showMax();
int m;
int main()
{
int i,x[3];
printf("Enter four numbers:");
for(i=0; i<=3; i++){
scanf("%d",&x[i]);}
m=max2(x);
showMax();
}
int max2(int h[3]){
int i;
int maxSofar1;
maxSofar1= h[0];
for(i=0; i<=2; i++){
if(h[i]>maxSofar1)
maxSofar1=h[i];}
return maxSofar1;
}
void showMax(){
printf("The max: %d",m);
}