This is my code and this is my logic
Code:
#include "stdafx.h"
#include "stdio.h"
#define SIZE 7
int main()
{
int array1[SIZE];
int dec;
int c;
printf("decimal: ");
scanf(" %d", &dec);
for(c=0;c<=7;c++)
{
array1[c]=dec%2;
dec=dec/2;
}
printf("\n\nThis is the binary number %d\n\n", array1[SIZE]);
system("pause");
}
I can not get the array to shift so I think the binary bits are overriding each other. I also get an error message saying that the stack around the variable array1 was corrupted. Any suggestions?