#include<stdio.h> //Program for Bubble Sorting int * bubblesort(int*,int); int display(int *,int); int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//Max. no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); display(a,N); //Sorting … Continue reading
RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict a: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: stdio.h and stdlib.h are added. —————————- revision 1.1 locked by: a; date: 2015/07/02 … Continue reading
#include main() { int n=10; int a[10]={89,22,20,2,11,39,32,21,87,98},swap=1,j,i,temp; printf(“this is a bubble sorting technique\n”); for(i=0;i<n&&swap==1;i++) { swap=0; for(j=0;j=a[j+1]) { swap=1; temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } else printf(“element sorted\n”); } } for(i=0;i<n;i++) { printf("a[%d]=%d\n",i,a[i]); } return 0; }
Logfile of compleated Project ————————————————— ————————————————— RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: It includes basic headers which are used … Continue reading
RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict reena: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: Header file include stio.h,fcntl.h,string.h all header file —————————- revision 1.1 locked by: reena; … Continue reading
#include<stdio.h> //Program for Selection Sorting int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//max no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); for(i=0;i<N;i++) printf(“%d\t”,*(a+i)); //Sorting Starts for(i=0;i<N-1;i++) for(j=i+1;j<N;j++) if(a[i]>a[j]) { … Continue reading
#include<stdio.h> //Program for Bubble Sorting int main() { int i,j,a[100],N,temp; printf(“Enter no.of elements you want to sort:\t”); scanf(“%d”,&N);//Max. no. of elements printf(“Enter %d elements you want to sort:\n”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore sorting:\t”); for(i=0;i<N;i++) printf(“%d\t”,*(a+i)); //Sorting Starts for(i=0;i<N-1;i++) for(j=0;j<N-i-1;j++) if(a[j]>a[j+1]) { … Continue reading
#include<stdio.h> //Program for Insertion Sorting int main() { int i,j,k,N,a[100],temp; printf(“Enter no. of elements you want to sort :\t”); scanf(“%d”,&N);//Max. no. of elements printf(“Enter %d elements you want to sort :\t”,N); for(i=0;i<N;i++) scanf(“%d”,(a+i)); printf(“\nBefore Sorting:\t”); for(i=0;i<N;i++) printf(“%d\t”,*(a+i)); //Sorting Process Start … Continue reading
Rules for using Switch Case in C Programming : 1. Case Label must be unique. 2.Case Label must ends with colon. 3.Case Label must have constants/ constant expression. 4.Case Label must be of Integral Type(Integer, Character). 5.Case Label should not … Continue reading
if we simply pass the address of local variable to a thread function then when that function ends then address of that variable lost(if variable is automatic) and we try to access that address or variable the it doesn’t give … Continue reading
In c linkllist is very important topic … Linklist have node which is connected one an other.linklist contain information(info) part and other part(Next) is address of other node.The type of info part is whatever you want like int,char,float,etc,but Next par … Continue reading
In data structure padding some allocate space is free this case is called is padding. Like a example is as as the structure we take three variable that is int,char,float. This is structure allocate 12 byte space. At the architecture … Continue reading
RCS file: insertion.c,v Working file: insertion.c head: 1.28 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 28; selected revisions: 1 description: it contains function for insertion isertion at end insertion at begin insertion after key elemnt() … Continue reading
//Quick sorting using Recursion #include<stdio.h> #include<stdlib.h> //Prototypes of functions used int * input(int *,int); int * sort(int *,int); void display(int*,int); int main() { int *a,n; printf(“Enter number of numbers you want to sort?\n”); scanf(“%d”,&n); a = input(a,n); a = sort(a,n);//call … Continue reading
#include<stdio.h> #include<stdlib.h> int * input(int *,int); int * sort(int *,int); void display(int*,int); int main() { int *a,n,i,j,c,temp; printf(“Enter number of numbers you want to sort?\n”); scanf(“%d”,&n); a = input(a,n); a = sort(a,n); display(a,n); } int * input(int *a,int n) { … Continue reading