in terms of java–
my class is –
class Element{
int value; Element e;
}
public static void main(String[] args){
Element obj=new Element(); // it wil assign 0 to obj.value and null to obj.e value by default
}
but below in c, in similar scenarios, “struct Element obj;” it will give 0 to obj.value by default but what about obj.e=???
my structure in c is as
struct Element1{
int value;
struct Element nextAddress;
};
struct Element{
int value;
struct Element *nextAddress;
};
struct Element *head=NULL;
struct Element1 head2=NULL (error why);
struct Element head1; //plz exaplain me what will happen when we write this line.. i know 0 will given
to value of head1 and
what will be assign to struct nextAddress as by default head1 is globaly declare in c //**here
we cant intilize this structure to NULL (Why) but in java we can do so**
// like suppose we have class Element than we can write as *Element e=NULL*;
void main(){
struct Element *p;
clrscr();
printf("%d",head1.value);//its giving 0
//how to check what is inside head1.nextAddress?? plz help me
//printf("%d",head1.value);
getch();
}