New paste Repaste Download
#include "stdio.h"
#include "stdlib.h"
#include "errno.h"
const int add(const int* number1, const int* number2)
{
  errno = 0;
  if (number1 == NULL || number2 == NULL)
  {
      errno = EINVAL;
      return -1;
  }
  
  return *number1 + *number2;
}
double* getInput()
{
  
  double* userInput = malloc(sizeof(double));
  if(scanf("%lf", userInput) != 1)
  {
    perror("Failed reading from buffer");
    free(userInput);
    return NULL;
  }
  
  return userInput;
}
int main() {
  double* userInput = getInput();
  if(userInput != NULL)
    {
      printf("%lf\n", *userInput);
      free(userInput);
    } else {
    fprintf(stderr, "Failed to allocate memory!");
  }
  return 0;
}
Filename: None. Size: 737b. View raw, , hex, or download this file.

This paste expires on 2024-05-25 01:48:34.046705. Pasted through web.