I have been getting a strange error when I use gcc to compile my c code.
This is my error: http://pastebin.com/dN4xXbQZ
This is my code:
// MemroyAllocationTester.c
// 2.20.11
// calloc() function allocates a group of objects.
// rather than malloc() which allocates a group of bytes.
#include <stdio.h>
#include <stdlib.h> // for calloc and free
main()
{
unsigned num;
int *pointer;
printf("Enter the number of type int to allocate: ");
scanf("%d", &num);
pointer = (int*)calloc(num, sizeof(int));
//if (pointer == NULL)
// puts("Memory allocation failed.");
//else
// puts("Memory allocation was successful.");
return(0);
}
Your problem is that your source file is Unicode (UTF-16), but your compiler is expecting ASCII (or UTF-8). You need to save your source file as ASCII (or UTF-8).
You could try compiling with
gcc -finput-charset=UTF-16but I suspect that won’t work because then it might try to interpret the header files as UTF-16 also, which they aren’t.