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

asked in Programming by Loyal (8.1k points) | 132 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 (396k points)

Related questions

+1 vote
1 answer
4
asked Jul 30, 2018 in Programming by CHïntän ÞäTël (285 points) | 42 views
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
50,122 questions
53,241 answers
184,705 comments
70,480 users