I am tring to build a program that deals with large numbers of 600+ digits, I know that I could not store these in an integer or even an unsigned long long, so I tried to use malloc() with the following syntax:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
int main()
{
int *a = malloc(2048);
if(a==NULL){exit(EXIT_FAILURE);}
int *b = malloc(2048);
if(b==NULL){exit(EXIT_FAILURE);}
int *c = malloc(2048);
if(c==NULL){exit(EXIT_FAILURE);}
scanf("%i", &a);
scanf("%i", &b);
c=a/b; //This is where it fails on compile
printf("%i /n", c);
free(a);
free(b);
free(c);
system("PAUSE");
return 0;
}
The 2048 bits are just a test value, as is the function of the program (just to find out if I can use arithmetic on malloc() variables).
The compiler complains of 'Invalid Operands to 'binary''
Any ideas on how to solve this would be very helpful, I am using Dev C++ with the C compiler function.
Thanks in advance!
Phil