Every time i try to compile this c program i get this error: cannot convert ‘double*’ to ‘const char*’ for argument ‘1’ to ‘int atoi(const char*)’ and when i try online gdb it works perfectly fine.Here is the code can anyone point out me to my mistake why this code not compiling on my side?
CODE:
#include <stdio.h>
#include <stdlib.h>
struct {
char c;
double d;
} s;
int main(int argc,char *argv[])
{
int a;
a = atoi(&s.d) - atoi(&s.c);
printf("alignment=%d\n",a);
printf("Size of char: %d\n",sizeof(s.c));
printf("Size of double: %d\n",sizeof(s.d));
printf("Size of struct: %d\n",sizeof(s));
}