The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
121 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 ?

asked in Programming by Loyal (7.7k points) | 121 views

1 Answer

0 votes

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

Ref: http://stackoverflow.com/questions/8220463/c-function-calls-understanding-the-implicit-int-rule

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) 
answered by Veteran (363k points)

Related questions

0 votes
1 answer
1
+1 vote
1 answer
2
+1 vote
1 answer
4
asked Jul 30 in Programming by CHïntän ÞäTël (139 points) | 38 views
0 votes
1 answer
5
0 votes
2 answers
6
0 votes
1 answer
7


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

42,625 questions
48,616 answers
155,895 comments
63,872 users