tutorialspoint.com is extremely terrible (at least when it comes to C) and as such must not be used. The standard resource to learn from is "The C Programming Language, 2nd edition" by Kernighan and Ritchie.
The preferred way to report stuff is to include the failing function in the message and use perror, e.g. perror("open")
EDIT: originally this did not include any justification for the claim about the site. I did not feel like it is necessary nor sensible. There is no write up I could link to either. They key was to avoid the site and everyone interested can easily conclude material in there is questionable at best and straight up wrong at worst.
However, since I got a weird backlash here are some excerpts:
http://www.tutorialspoint.com/c_standard_library/c_function_malloc.htm
#include <stdio.h>
#include <stdlib.h>
Missing include for strcpy and strcat.
int main()
{
char *str;
/* Initial memory allocation */
str = (char *) malloc(15);
No need to cast malloc. Missing null-check. Why the 15?
strcpy(str, "tutorialspoint");
Bad error-inducing style. What if the length was to change? If an explicit allocation really needs to happen, strlen() + 1 can be used to get the needed size.
printf("String = %s, Address = %u\n", str, str);
'u' is an incorrect specifier for pointer type.
/* Reallocating memory */
str = (char *) realloc(str, 25);
Standard bad idiom. The code should use a temporary pointer to recover from error, or if recovery is not an option, exit.
strcat(str, ".com");
What's up with realloc from 15 to 25 just to add ".com"?
printf("String = %s, Address = %u\n", str, str);
free(str);
return(0);
}
Does this justify my claim about the site?