Why I get on Segmentation fault for this code ?
#include <stdio.h>
void main(){
int *ptr;
*ptr =24;
if(*ptr < 12)
printf("************** 1\n");
if(*ptr > 64)
printf("************** 2");
}
update: I need to compare the value of pointer *ptr =24; with the if statement, there is no output!
int data = 24;
int *ptr =&data;
if(*ptr < 12){
printf("************** 1\n");
}
if(*ptr > 64)
{
printf("************** 2");
}