EmbLogic's Blog

Author Archives: Pankaj Suryawanshi

What is bss (Block Storage Start) ?

The .bss segment stores all uninitialized global, static, and external variables (declared with extern keyword). Global, external, and static variable are by default initialized to zero. This section occupies no actual space in the object file. it is merely a … Continue reading

Posted in Data Structures with C | Leave a comment

Matrix Addition using 2D Array with Pointers

#include #include int main() { int r,c,k; printf(“enter the size of rows\n”); scanf(“%d”,&r); printf(“enter the size of columns\n”); scanf(“%d”,&c); int **a,**b,**d,i,j; a=(int **)malloc(sizeof(int*)*3); if(!a) { perror(“malloc”); goto x; } for(i=0;i<3;i++) *(a+i)=(int *)malloc(sizeof(int)*3); if(!(*(a+i))) { perror("malloc"); goto x; } b=(int **)malloc(sizeof(int*)*3); … Continue reading

Posted in Data Structures with C | Leave a comment

write a program for selection sort

#include<stdio.h> int main() { int a[5]; int i,j,loc,smallest,temp; printf(“enter array element”); for(i=0;i<5;i++) { scanf(“%d”,&a[i]); } for(j=0;j<5;j++) { smallest=a[j]; for(i=j+1;i<5;i++) { if(a[i]<smallest) { smallest=a[i]; loc=i; temp=a[j]; a[j]=a[loc]; a[loc]=temp; } } printf(“sorted array is[%d]=%d\n”,j,a[j]); } return 0; }

Posted in Uncategorized | Leave a comment