2.2 Mark by '*' all instructions with compilation errors
void syntaxErrors(void)
{
char *p1="12345";
char a0[]="12345";
char a1[1]="123"; *warning: initializer-string for array of chars is too long|
char c;
p1=a0;
a0=p1; * error: incompatible types in assignment|
a0==p1; *warning: statement with no effect|
p1=c; *warning: assignment makes pointer from integer without a cast|
p1=&c;
strcmp(c,a0); *warning: implicit declaration of function `strcmp'| **warning: passing arg 1 of `strcmp' makes pointer from integer without a cast|
strcmp(@c,p1); *error: stray '@' in program| **warning: passing arg 1 of `strcmp' makes pointer from integer without a cast|
a0=(char*) calloc(1,10); *error: incompatible types in assignment| **warning: implicit declaration of function `calloc'|
p1=(char*) calloc(1,10);
free(a1); *warning: implicit declaration of function `free'|
free(c);
free(&c);
return 'a'; } *warning: `return' with a value, in function returning void|
5.1 Which functions are not properly defined. Justify your
answer.
int * p1() {
int i1;
return(&i1); |6|warning: function returns address of local variable|
}
int * p2() {
static int i1;
return(&i1);
}
int globInt;
int * p3() {
return(&globInt);
}
int p4() {
int result;
return(result);
}
int *p5() {
return((int*) malloc(sizeof(int)));
}
when compiled i get this error again: |undefined reference to `_WinMain@16'|
i get this error again: |undefined reference to `_WinMain@16'| (sic)
The linker is telling you that it cannot find the definition of _WinMain(). This is due to an incorrect project setup; that is, your project is a Win32 GUI, not a console. Normally, the target medium can be set in the project's settings.