132 views

CASE A:

CASE A:
‪#‎include‬<stdio.h>
int divide( int a, b)
{ return 7; }
int main() {
int a=divide(8,3);
printf("%d",a);
return 0;
} 

CASE B :

CASE B :
#include<stdio.h>
int divide( a, b)
{ return 7;
}
int main()
{ int a=divide(8,3);
printf("%d",a);
return 0; } 

why is CASE A an error and CASE B error free , in CASE B acc to c99 standard it assumes the variables to be of type int but then why not in case A , why is the type of b not considered to be of type int ?

why is CASE A an error and CASE B error free ,

in CASE B acc to c99 standard it assumes the variables to be of type int but then why not in case A , why is the type of b not considered to be of type int ?

One of the major changes in C99 standard is the removal of implicit 'int' and 'implicit function declaration'.

Try compiling your code with two standards as follows

gcc -Wall -std=c99 code.c
gcc -Wall -std=c89 code.c

I could not get the exact rule for implicit int, but the following isn't the place where 'implicit' works as clear from the error. Why worry about some stuff outdated in 1999? Currently we have to write declaration for all identifiers in C.

int divide( int a, b)


1
+1 vote
2
+1 vote
3
+1 vote
4
5
6