I was trying to create a small program to read the contents of the ram that I input. Here is the code:
#include <stdio.h>
#include <unistd.h>
typedef unsigned char BYTE;
int main(){
BYTE *ptr=NULL;
BYTE *lastPtr=NULL;
char bits[8];
int a=0;
printf("Memory Adress:");
scanf("%p",&ptr);
printf("%p: %c\n",ptr,*ptr);
printf("Number of bytes to be analysed:");
scanf("%d",&a);
lastPtr=ptr+a;
while(ptr<lastPtr){
for(int i=0;i<8;i++){
bits[i]=((*ptr) & (1<<i) )!=0;
}
printf("%s\n",bits);
ptr++;
}
}