Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

489
Vistas
C program: implicit declaration of function and conflicting types

Here's a function calculating the division of two numbers. All variables and functions are declared as float. However, the code below does not compile and the error message shows that "%f expects argument of type double, but argument has type int" and "implicit declaration of function 'div'" and "conflicting types for 'div'".

#include <stdio.h>
#include <assert.h>

float div(float a, float b);

int main() {
  float a = 5;
  float b = 8;
  printf("%f divided by %f is %f \n", a, b, div(a, b));
}

float div(float a, float b) { 
  assert(b != 0);
  return a / b;
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The 2018 C standard discusses the standard library in clause 7. C 2018 7.1.3 1 says:

… All identifiers with external linkage in any of the following subclauses (including the future library directions) and errno are always reserved for use as identifiers with external linkage.

In one of the following subclauses, 7.22.6.2, div is described as a function, and hence as an identifier with external linkage.

Therefore, it is reserved for use as the name of a standard library routine, and the behavior of a program that uses it for another purpose is not defined by the C standard.

Rename your function.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda