শুক্রবার, ৩০ অক্টোবর, ২০১৫

Let Guess The output !

#include <stdio.h>

int main(void) {

int a;

int b;

printf("address of a = %u\n address of b = %u",&a,&b);

    return 0;

}


output :
address of a = 3213468520
address of b = 3213468524
but if I point b as int*pointer=&b;
what willbe the value of pointer  followed by my sample output? 

শনিবার, ২৪ অক্টোবর, ২০১৫

Output ???

#include <stdio.h>

int main(void) {

int True=1,False=0;
int logic_1 = (True || False);
int logic_2 = (True && True);
int logic_3 = (False || False);
int logic_4 = (True != True);
int logic_5 = (True == False);
int logic_6 = (False !=True);
printf("\n %d\n %d\n %d\n %d\n %d\n %d",logic_1,logic_2,logic_3,logic_4,logic_5,logic_6);

 return 0;
}

মঙ্গলবার, ২০ অক্টোবর, ২০১৫

exaple of LIFO(Last in first out )

#include<stdio.h> // এই লাইন টি হেডার। 
int main(){     /*{ব্রাকেট এর ভেতরের   পুরো    অংশ টাই  মেইন  function এর বডি      }*/
 int a;   /*আমি  একটা ইন্টিজার টাইপ এর a নামের ভেরিয়েবল নিই */

 a=10; //এখানে আমি a  এর মান দিলাম ১০.

 a=12; //এখানে আবার a =১২ দিলাম।

 a=5;   //এখানে আবার a =৫ দিলাম

 a=6;  //সবার লাস্টে a = ৬ দিলাম।
printf("%d",a); //প্রিন্ট করলাম a এর মান।
return 0;



}
এখন আপনার কাজ হবে প্রোগ্রামটি রান না করে বলা আউট পুট  কত হবে ?
আর  একটু বলি a এর সব মান স্ট্যাক স্ট্রাকচার এ ইন  হবে।

শনিবার, ১৭ অক্টোবর, ২০১৫

Try to run it.You never get same output.

#include <stdio.h>
struct node{
int data;
struct node*link;
 
};
typedef struct node x;
x*head,*k;
int main(void) {
int n=10,i=0;
for( ;i<n;++i){
 if(head==NULL){
x*temp=malloc(sizeof(x));
 temp->data=i;
 head=temp;
 k=temp;
 }
else
{
 x*temp1=malloc(sizeof(x));
 k->link=temp1;
 k=temp1;
 k->link=NULL;
}
}
while(head!=NULL){
printf("%p\t%p\n",head,head->link);
head=head->link;
} 
return 0;
}
 
----------------------------------------------------------------------
look at the output!
If you run this code,you w'll never get the same output as:
 
0x9304078 0x93040a0
0x93040a0 0x93040c8
0x93040c8 0x93040f0
0x93040f0 0x9304118
0x9304118 0x9304140
0x9304140 0x9304168
0x9304168 0x9304190
0x9304190 0x93041b8
0x93041b8 0x93041e0
0x93041e0 (nil)
 
visualize the 1st node holds the address of 2nd node.
according to the program,what will be the head and tail of this list?
obviously head is "0x9304078" and tail is (nil) or NULL.
  

circuler simple link list & print data from list...

#include<stdio.h>
struct node{
int rool;
struct node*link;
};
typedef struct node x;
x*head;
int main(){

x*temp=malloc(sizeof(x));
temp->rool=12;
head=temp;
x*temp1=malloc(sizeof(x));
temp1->rool=13;
temp->link=temp1;
x*temp2=malloc(sizeof(x));
temp2->rool=14;
temp1->link=temp2;
temp2->link=temp;
while(2!=1){
printf("%d\n",head->rool);
if(head->link==temp)
break;
head=head->link;
}
return 0;
}

print data from list !

#include<stdio.h>
struct node{
int rool;
struct node*link;
};
typedef struct node x;
x*head;
int main(){

x*temp=malloc(sizeof(x));
temp->rool=12;
head=temp;
x*temp1=malloc(sizeof(x));
temp1->rool=13;
temp->link=temp1;
x*temp2=malloc(sizeof(x));
temp2->rool=14;
temp1->link=temp2;
temp2->link=NULL;
while(head!=NULL){

printf("%d\n",head->rool);
head=head->link;
}

return 0;



}

Draw the linklist of folowing code !

#include <stdio.h>
#include<stdlib.h>
struct node{
int rool;
struct node*next;

};

struct none *head;
int main(void) {


struct node*temp=malloc(sizeof(struct node));
temp->rool=1;                                                       

head=temp;

struct node*temp1=malloc(sizeof(struct node));
temp1->rool=2;
temp->next=temp1;
struct node*temp2=malloc(sizeof(struct node));
temp2->rool=3;
temp1->next=temp2;
temp2->next=NULL;
printf("%d\t%d\t%d",temp->rool,temp1->rool,temp2->rool);
printf("%p%p%p",temp,temp1,temp2);
    return 0;
}