EmbLogic's Blog

Category Archives: Data Structures with C

Information: Regarding Signal Number 32 and 33

Signal              Number           Default Action                  Remarks SIGWAITING        32                    Ignore        Cocurrancy signal used by threads library SIGLWP             33                     Ignore        Inter LWP signal used by thread library Where LWP: light … Continue reading →

Posted in Data Structures with C, Linux Internals and System Programming | Leave a comment

sorting

what is selection and bubble sorting implemented //

Posted in Data Structures with C | Leave a comment

what is a compiler

what is the difference between compiler and assembler?

Posted in Data Structures with C | 2 Comments

ARRAY: the name of confusion

#include <stdio.h> int main() { int a[5][5],c[5][5],i,j; int b[2][3]={{1,2,3},{3,4,5}};         for(i=0;i<5;i++)         {         for(j=0;j<5;j++)         {         printf(“array B: %d\n”,b[i][j]);         printf(“enter array A: “);         scanf(“%d”,&a[i][j]);         c[i][j]=a[i][j]+b[i][j];         printf(“c[%d}[%d] : %d \n\n  “,i,j,c[i][j]); } } return 0; … Continue reading →

Posted in Data Structures with C | 1 Comment

Can i initialize an union members like structure???if yes then why i am getting so much warning in the following programm????

#include<stdio.h> union logic { int i; char x[2]; //char y; }emb={510,’A’,’B’}; int main() { printf(“%d\n”,emb.i); printf(“%c\n”,emb.x[0]); printf(“%c\n”,emb.x[1]); printf(“%d\n”,emb.i); }

Posted in Data Structures with C | 1 Comment

I am getting segmentation fault in the following Pgm..please explain if u clear about structure ponter…i am facing the issue that …is it madatory to initialize struct pointer?????

#include<stdio.h> #include<string.h> struct logic { char ch[10]; char x; int y; char z; //int i; }; int main() { struct logic *p; strcpy(p->ch,”hello”); p->x=’b’; p->y=42; p->z=’c’; printf(“%s\n%c\n%d\n%c\n”,p->ch,p->x,p->y,p->z); }  

Posted in Data Structures with C | 1 Comment

To SIDHARTH SIR

char (* ( *f())[])(); How to evaluate that kind of expression??

Posted in Data Structures with C | 1 Comment

problem in insertion sort….. what is the problem??

#include int insertion_sort(int *a,int elem) { int temp=0,temp2=0,max=0,i=0,j=0; for(i=0;i<elem-1;i++) { temp=*(a+i+1); for(j=i;temp0;j–) *(a+j+1)=*(a+j); *(a+j)=temp; } printf(“sorting done…”); return 0; } int main() { int a[]={10,9,8,7,6,5,4,3,2,1},i=0; insertion_sort(a,10); for(i=0;i<=10;i++) printf("%d\n",*(a+i)); return 0; }

Posted in Data Structures with C | 1 Comment

facing associativity issue in last two statments of the followin programme…pls explain it

{ int x=1,y=1,z=1; x+=y+=z; printf(“%d\n”,x<y?y:x); printf(“%d\n”,x<y?x++:y++); printf(“%d\n”,x);printf(“%d\n”,y); printf(“%d\n”,z+=x<y?x++:y++); printf(“%d\n”,y);printf(“%d\n”,z); x=3,y=z=4; printf(“%d\n”,z>=y>=x?1:0); printf(“%d\n”,z>=y&&y>=x)

Posted in Data Structures with C | 2 Comments

issue in assignement 1

in qo 3 how airthmetic operators are performing

Posted in Data Structures with C | 2 Comments

issue in printf

Can any one tell me how printf is executing….

Posted in Data Structures with C | 1 Comment

how to take string as input from the user ???

#include<string.h> #include<stdio.h> #include<stdlib.h> int main() { int d; printf(“enter size of the string\n”); scanf(“%d”,&d); char a[100]; char *p; p = malloc(sizeof(char)*d); printf(“enter the string\n”); fflush(stdin); fgets(p,d,stdin);                             //didn’t worked with gets(p)????????? int i,j,count=0,flag=0; for(i=0;i<=”;i++) { for(j=0;j<i;j++) { if(*(p+i)==a[j]) { flag=-1; } … Continue reading →

Posted in Data Structures with C | 1 Comment

warning on arrays

{ char r[10]=”this is a”; char d[10]={{‘t’},{‘h’},{‘i’},{‘s’},{‘ ‘},{‘i’},{‘s’},{‘ ‘},{‘a’}}; printf(“string r[10]  %s  size %d\n”,r,sizeof(r)); printf(“single character d[10] %s size %d\n”,d,sizeof(d)); return 0; } during compilation it gives warning WHY ? what wrong i had done in char d[10] ? warning: … Continue reading →

Posted in Data Structures with C | 2 Comments

assignment 1,ques26..?how to implememnt it..

anybody attempted it?

Posted in Data Structures with C | Leave a comment

query regarding Assignment1 question 13

printf(“%d%d%d\n”,i,i+1,i+2); Why the output is in -ve  for i+1 and  i+2? 2147483647 – 2147483648 -2147483647

Posted in Data Structures with C | 2 Comments