EmbLogic's Blog

creating master-array(in which all the distinct character of file given by user are stored) for project–”Multiple Data Compression & Encryption”………..

RCS file: main.c,v
Working file: main.c
head: 1.3
branch:
locks: strict
root: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;    selected revisions: 3
description:
created master array which contains distinct characters of file which is opened
—————————-
revision 1.3    locked by: root;
date: 2014/07/18 16:15:11;  author: root;  state: Exp;  lines: +4 -1
*** empty log message ***
—————————-
revision 1.2
date: 2014/07/18 16:09:59;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2014/07/18 15:55:50;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Data Structures with C | Leave a comment

Queue : using array (enque, deque, search, traverse)

1
2 RCS file: main.c,v
3 Working file: main.c
4 head: 1.8
5 branch:
6 locks: strict
7 access list:
8 symbolic names:
9 keyword substitution: kv
10 total revisions: 8;     selected revisions: 8
11 description:
12 Implementing queue operations using an array.
13 —————————-
14 revision 1.8
15 date: 2014/07/18 06:43:04;  author: root;  state: Exp;  lines: +1 -1
16 search() function successfully prints the index of multiple instances of a value.
17 search, enque, deque, traverse functions implemented and tested.
18 —————————-
19 revision 1.7
20 date: 2014/07/18 06:40:30;  author: root;  state: Exp;  lines: +11 -4
21 testing the search function.
22 testing failed.
23 —————————-
24 revision 1.6
25 date: 2014/07/18 06:31:08;  author: root;  state: Exp;  lines: +1 -1
26 Testing search function for multilple instances of a value in the queue.
27 Testing failed.
28 Output : not as expected.
29 —————————-
30 revision 1.5
31 date: 2014/07/18 06:28:11;  author: root;  state: Exp;  lines: +29 -2
32 Implemented the deque function successfully.
33 Tested ok with tried test cases.
34 —————————-
35 revision 1.4
36 date: 2014/07/18 05:56:19;  author: root;  state: Exp;  lines: +5 -3
“log_file” 54L, 1995C                                                                                                               1,0-1         Top

Posted in Project 2: Multiple Data Compression and Encryption | Leave a comment

file opening

RCS file: mdc.c,v
Working file: mdc.c
head: 1.4
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 4; selected revisions: 4
description:
started the project on data compression.
opening file .
—————————-
revision 1.4
date: 2014/07/17 10:00:14; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.3
date: 2014/07/17 09:59:18; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.2
date: 2014/07/17 09:43:03; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2014/07/17 08:44:28; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

opening a file, used some tools like rcs….

RCS file: mdc.c,v
Working file: mdc.c
head: 1.6
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 6;    selected revisions: 6
description:
Started the project “muldiple data compression & encryption.
Read file with open command.
—————————-
revision 1.6
date: 2014/07/17 09:17:51;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.5
date: 2014/07/17 09:17:28;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2014/07/17 09:12:44;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.3
date: 2014/07/17 09:11:07;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.2
date: 2014/07/17 09:04:33;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2014/07/17 09:01:15;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Data Structures with C | Leave a comment

char driver ( read multiple qset n multiple quantum )

RCS file: reader.c,v
Working file: reader.c
head: 1.74
branch:
locks: strict
root: 1.74
access list:
symbolic names:
keyword substitution: kv
total revisions: 74; selected revisions: 74
description:
—————————-
revision 1.74 locked by: root;
date: 2014/07/17 02:24:05; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.73
date: 2014/07/15 11:42:11; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.72
date: 2014/07/15 10:47:49; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.71
date: 2014/07/15 09:20:26; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.70
date: 2014/07/15 09:19:05; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.69
date: 2014/07/15 09:07:36; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.68
date: 2014/07/15 09:05:26; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.67
date: 2014/07/15 09:04:15; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.66
date: 2014/07/15 09:02:57; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.65
date: 2014/07/15 08:42:07; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.64
date: 2014/07/15 08:37:10; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.63
date: 2014/07/15 08:30:58; author: root; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.62
date: 2014/07/15 07:57:58; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.61
date: 2014/07/15 07:48:05; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.60
date: 2014/07/15 07:16:07; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.59
date: 2014/07/15 07:14:06; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.58
date: 2014/07/15 07:13:29; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.57
date: 2014/07/15 07:12:35; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.56
date: 2014/07/15 07:11:48; author: root; state: Exp; lines: +4 -4
*** empty log message ***
—————————-
revision 1.55
date: 2014/07/15 07:03:23; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.54
date: 2014/07/15 07:01:31; author: root; state: Exp; lines: +3 -3
*** empty log message ***
—————————-
revision 1.53
date: 2014/07/15 06:02:06; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.52
date: 2014/07/15 06:01:21; author: root; state: Exp; lines: +6 -1
*** empty log message ***
—————————-
revision 1.51
date: 2014/07/15 05:17:37; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.50
date: 2014/07/15 05:14:06; author: root; state: Exp; lines: +56 -28
*** empty log message ***
—————————-
revision 1.49
date: 2014/07/15 02:49:51; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.48
date: 2014/07/15 02:48:17; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.47
date: 2014/07/14 11:04:51; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.46
date: 2014/07/14 09:25:12; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.45
date: 2014/07/14 09:22:56; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.44
date: 2014/07/14 09:22:16; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.43
date: 2014/07/14 09:21:20; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.42
date: 2014/07/14 09:20:08; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.41
date: 2014/07/14 09:16:54; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.40
date: 2014/07/14 09:16:18; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.39
date: 2014/07/14 09:14:55; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.38
date: 2014/07/14 07:59:55; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.37
date: 2014/07/14 07:57:00; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.36
date: 2014/07/14 07:49:40; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.35
date: 2014/07/14 07:48:59; author: root; state: Exp; lines: +3 -1
*** empty log message ***
—————————-
revision 1.34
date: 2014/07/14 07:39:50; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.33
date: 2014/07/14 07:38:35; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.32
date: 2014/07/14 07:37:44; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.31
date: 2014/07/14 07:36:51; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.30
date: 2014/07/14 07:15:05; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.29
date: 2014/07/14 07:10:49; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.28
date: 2014/07/14 06:58:32; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.27
date: 2014/07/14 06:06:18; author: root; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.26
date: 2014/07/14 06:03:06; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.25
date: 2014/07/14 05:58:28; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.24
date: 2014/07/14 05:42:21; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.23
date: 2014/07/14 05:40:53; author: root; state: Exp; lines: +1 -1
./
—————————-
revision 1.22
date: 2014/07/14 03:43:06; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.21
date: 2014/07/12 11:30:33; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.20
date: 2014/07/12 11:19:22; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.19
date: 2014/07/12 09:15:09; author: root; state: Exp; lines: +4 -3
*** empty log message ***
—————————-
revision 1.18
date: 2014/07/12 07:59:02; author: root; state: Exp; lines: +3 -9
*** empty log message ***
—————————-
revision 1.17
date: 2014/07/12 07:35:08; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.16
date: 2014/07/12 07:27:18; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.15
date: 2014/07/12 07:21:35; author: root; state: Exp; lines: +2 -0
*** empty log message ***
—————————-
revision 1.14
date: 2014/07/12 06:51:09; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.13
date: 2014/07/12 06:04:51; author: root; state: Exp; lines: +3 -2
*** empty log message ***
—————————-
revision 1.12
date: 2014/07/12 06:03:56; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.11
date: 2014/07/12 06:02:30; author: root; state: Exp; lines: +4 -2
*** empty log message ***
—————————-
revision 1.10
date: 2014/07/12 05:50:12; author: root; state: Exp; lines: +5 -2
*** empty log message ***
—————————-
revision 1.9
date: 2014/07/12 04:19:07; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.8
date: 2014/07/12 04:18:09; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.7
date: 2014/07/12 03:57:44; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.6
date: 2014/07/12 03:56:02; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.5
date: 2014/07/12 03:49:53; author: root; state: Exp; lines: +5 -1
*** empty log message ***
—————————-
revision 1.4
date: 2014/07/12 03:47:27; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.3
date: 2014/07/12 03:43:16; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.2
date: 2014/07/12 03:41:43; author: root; state: Exp; lines: +1 -2
*** empty log message ***
—————————-
revision 1.1
date: 2014/07/12 03:32:14; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

char driver(write multiple qset n multiple quantum)

RCS file: write.c,v
Working file: write.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
—————————-
revision 1.1
date: 2014/07/12 02:59:42; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

Program in c to print sin wave.

#include<stdio.h>
#include<math.h>
int main()
{
double a,b,i;
int j;
int count=0;
a=22.0/7.0;
for(i=0.0; i <= 4.0; i+=0.1)
{
b= sin(a*i)+ cos(a*i);
if(b >= 0)
{
printf(”          “);
for(j =10*b;j >= 0.0; j-=1.0)
{
printf(” “);
}
}
if(b < 0.0)
{
for(j=10 +(10*b);j>=0.0;j-=1.0)
{
printf(” “);
}
}
printf(“*\n”);

}
return 0;
}

********************************************************************************************

Posted in Uncategorized | Leave a comment

concatinate two strings using function,pointer and memory allocation

#include<stdio.h>
#include<stdlib.h>
int main()
{
char a[20]={0},b[10]={0};
int i,j=0;
printf(“Enter name1:\n”);
scanf(“%s”,a);
printf(“Enter second name:\n”);
scanf(“%s”,b);
for(i=0;i<20;i++)
{
if(a[i]==”)
{
a[i]=b[j]; j++;
}
}
printf(“Concatination is: %s\n”,a);
return 0;
}

 

note: – output

enter the name 1=hye

enter the name 2=dude

concatination is hyedude

Posted in Uncategorized | Leave a comment

C assignment link list operations Q1(pass by value method)

HEADER.h

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

};
int get_choice();
struct node * operation(int, struct node *);
struct node * create_node(struct node *);
struct node * insert_node(struct node*);
struct node * insert_beg(struct node*);
struct node * insert_end(struct node*);
struct node * insert_nth(struct node*);
struct node * insert_key(struct node*);
struct node * delete_node(struct node*);
struct node * del_beg(struct node *);
struct node * del_end(struct node *);
struct node * del_nth(struct node *);
struct node * del_key(struct node *);
struct node * display(struct node*);
struct node * sorting(struct node *);
struct node * sort_ascend(struct node *);
struct node * sort_descend(struct node *);
struct node * destroy(struct node *);

MAIN

#include”header.h”
int main()
{
struct node  * start;
start =  NULL;
int choice;
while(1)
{        choice = get_choice();
start=operation(choice,start);
}

}

FUNCTON DEFINITIONS

#include”header.h”
int flag=0;
int get_choice()                                        //getchoice from user
{
int choice;
printf(“\n—————_MENU————–\n”);
printf(”  1. CREATE LINK LIST\n”);
printf(”  2. INSERT\n”);
printf(”  3. DELETE\n”);
printf(”  4. SORT\n”);
printf(”  5. DISPLAY\n”);
printf(”  6. DESTROY\n”);
printf(”  0. Exit\n”);
printf(“\n\n  Enter your choice…\n”);

scanf(“%d”,&choice);
return choice;
}

struct node * operation(int choice,struct node *start )                    //operations
{

struct node * temp;
switch(choice)
{
case 1: temp=create_node(start);
break;
case 2: temp=insert_node(start);
break;
case 3: temp=delete_node(start);
break;
case 4: temp = sorting(start);
break;
case 5: temp=display(start);
break;
case 6: temp = destroy(start);
free(temp);
break;
case 0: exit(0);
default:printf(“\nINVALID OPTION”);

}return temp;

}

struct node * create_node(struct node *start)                            //create first node
{

if(flag)
{ printf(“link list is already created\n”);
}
if(flag==0)
{
start=(struct node*)malloc (sizeof(struct node));
printf(“enter the info of link list \n”);
scanf(“%d”, &(start->info));
start->next = NULL;
flag = 1;
printf(“link list created successfully\n”);
printf(“first element is %d\n”, start->info);
return start;

}
}

struct node * insert_node(struct node *start)                            //insert node menu
{
struct node *temp1;

if(flag==0)
printf(“linked list not created!\n”);
else
{
int choice;
printf(“___________INSERT MENU_______________\n”);
printf(“1. INSERT AT BEGGINING\n”);
printf(“2. INSERT AT END\n”);
printf(“3. INSERT AT NTH\n”);
printf(“4. INSERT AFTER KEY VALUE\n”);
printf(“\n\nEnter your choice…\n”);
scanf(“%d”,&choice);
switch(choice)
{
case 1:temp1 = insert_beg(start);
break;

case 2:temp1 = insert_end(start);
break;

case 3:temp1 = insert_nth(start);
break;

case 4:temp1 = insert_key(start);
break;
default : printf(“\nINVALID”);
}
return temp1;
}
}
struct node * insert_beg(struct node *start)                                //insert at begining
{
struct  node *b;
b=(struct node *)malloc(sizeof(struct node));
printf(“enter the element of node\n”);
scanf(“%d”,&(b->info));
b->next = start;
start = b;
return start;

}

struct node * display(struct node *start)                                //display
{
int num=0;
struct node *new,*temp;
temp=start;
new = start;
if(flag==0)
{    printf(“\nlink list is empty!!!\n”);
}
while(temp)
{    temp=temp->next;
num++;
}
//    printf(“\nthe number of nodes are %d”,num);
if(flag)
{
if(num==0)
{    printf(“\nList is empty !!!!”);
return start;
}
else
{    printf(“the link list is —>>”);
do
{
printf(” %d “, new->info);
new = new -> next;
}while(new!=NULL);
return start;
}
}
}

struct node * insert_end(struct node *start)                                //insert at end
{
struct node *b, *n;
n = start;
b=(struct node *)malloc(sizeof(struct node));
printf(“enter the info of node\n”);
scanf(“%d”,&(b->info));
printf(“\nthe last element is %d”,b->info);

while(n->next)
{     n=n->next;
}
n->next = b;
b->next = NULL;
return start;
}

struct node * insert_nth(struct node *start)                                //insert at nth node
{
int pos,i;
struct node *temp,*new,*b;
new=(struct node *)malloc(sizeof(struct node));
temp = start;
printf(“enter the position you want to insert at \n”);
scanf(“%d”,&pos);
for(i=1;i<pos-1;i++)
{     temp    = temp ->next;
}
b=temp->next;
printf(“enter the info of node\n”);
scanf(“%d”,&(new->info));
temp->next=new;
new->next=b;

printf(“link added successfully\n”);
return start;
}

struct node * insert_key(struct node *start)                                //insert after key
{
int key;
struct node *new,*temp,*b;
temp=start;
new=(struct node *)malloc(sizeof(struct node));
printf(“enter the key value \n”);
scanf(“%d”,&key);
while(key!= (temp->info))
{    temp=temp->next;
}
printf(“enter the info of the node\n”);
scanf(“%d”,&(new->info));
b=temp->next;
temp->next=new;
new->next=b;
return start;
}

struct node * delete_node(struct node *start)                                //delete node menu
{
int choice;
struct node *temp;

if(flag==0)
printf(“linked list empty!!!\n”);
else
{
printf(“———-DELETE MENU———–\n”);
printf(“1. Delete from begining\n”);
printf(“2. Delete from end\n”);
printf(“3. Delete nth node \n”);
printf(“4. Delete after key value\n”);
printf(“\n\nEnter your choice\n”);
scanf(“%d”,&choice);
switch(choice)
{
case 1 : temp = del_beg(start);
break;
case 2 : temp = del_end(start);
break;
case 3 : temp = del_nth(start);
break;
case 4 : temp = del_key(start);
break;
default : printf(“\nINVALID”);
}
return temp;
}
}

struct node *del_beg(struct node *start)                                //delete menu
{
struct node *temp;
temp=start;
int num=0;
while(temp)
{    temp= temp->next;
num++;
}

if(num==0)
printf(“nothing to delete\n”);
else
{    start = start->next;
return start;
}
}

struct node *del_end(struct node *start)                                //delete from end
{
struct node *temp;
temp = start;
int num=0;
while(temp)
{    temp= temp->next;
num++;
}
temp=start;
if(num==0)
{    printf(“\nnothing to delete”);
}
else
{    while(temp->next->next)
{    temp=temp->next;
}
temp->next=NULL;
return start;
}
}

struct node * del_nth(struct node *start)                                //delete nth node
{
int pos,i;
struct node *temp,*b;
temp = start;
int num=0;
while(temp)
{    temp= temp->next;
num++;
}
temp=start;
if(num==0)
printf(“\nnothing to delete”);
else
{    printf(“enter the position\n”);
scanf(“%d”,&pos);
for(i=1;i<pos;i++)
{    temp = temp->next;
}
b = temp->next;
temp=start;
for(i=1;i<pos-1;i++)
{    temp = temp->next;
}
temp->next=b;
return start;
}
}

struct node * del_key(struct node *start)                                //delete at key value
{
int key,num=0;
struct node *temp,*b;
temp=start;
if(num==0)
printf(“\nnothing to delete”);
else
{    printf(“enter the node to delete\n”);
scanf(“%d”,&key);
while(temp->info != key)
{    temp = temp->next;
}
if(!temp)
{    printf(“\nthe entered key not found”);
return start;
}
b=temp->next;
temp=start;
while(temp->next->info != key)
{    temp=temp->next;
}
temp->next=b;
return start;
}

}
struct node * sorting(struct node * start)                                //sorting menu
{
int choice;
struct node *temp;
printf(“\n————-SORTING MENU————–”);
printf(“\n1. sort ascending”);
printf(“\n2. sort descending”);
printf(“\n\nenter your choice”);
scanf(“%d”,&choice);
switch(choice)
{    case 1 : temp = sort_ascend(start);
break;
case 2 : temp = sort_descend(start);
break;
default : printf(“\nINVALID”);
}
return temp;

}

struct node * sort_ascend(struct node *start)                                 //sorting ascending order(bubble sort)
{
int count=0,j,i;
struct node *temp,*b;
b=(struct node *)malloc(sizeof(struct node ));
b->next=NULL;
temp = start;
while(temp)
{    temp=temp->next;
count++;
}
temp=start;
printf(“\nthe no of nodes are %d”,count);
if(!count)
printf(“\nThe Link list is empty!!!”);
else
{
for(j=0;j<count;j++)
{
for(i=0;i<count-j-1;i++)
{    if((temp->info) > (temp->next->info) )
{    b->info = temp->info;
temp->info = temp->next->info;
temp->next->info = b->info;
temp=temp->next;

}
else
temp=temp->next;
}
temp=start;
}
return start;
}
}

struct node * sort_descend(struct node *start)                                //sorting descending order(bubble sort)
{

int count=0,j,i;
struct node *temp,*b;
b=(struct node *)malloc(sizeof(struct node ));
b->next=NULL;
temp = start;
while(temp)
{    temp=temp->next;
count++;
}
temp=start;
printf(“\nthe no of nodes are %d”,count);
if(!count)
printf(“The Link list is empty!!!!”);
else
{
for(j=0;j<count;j++)
{
for(i=0;i<count-j-1;i++)
{    if((temp->info) < (temp->next->info) )
{    b->info = temp->info;
temp->info = temp->next->info;
temp->next->info = b->info;
temp=temp->next;

}
else
temp=temp->next;
}
temp=start;
}
return start;
}
}

struct node * destroy(struct node * start)                                //destroy link list
{
start=NULL;
printf(“\nThe Link List has been Destroyed”);
return start;

}

 

Posted in Data Structures with C | Leave a comment

LINKLIST CREATE MULTIPLE NODES DLETE MULTIPLE NODE IN SINGLE TIME

RCS file: ./linklist1.c,v
Working file: ./linklist1.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
make a struct for linklist and defined three pointers start,prev,end .
data store more than 10 bytes in single node.
create multiple node.
—————————-
revision 1.2    locked by: root;
date: 2014/07/15 11:15:21;  author: root;  state: Exp;  lines: +33 -10
create linklist in loop and delete in while according to choice.
—————————-
revision 1.1
date: 2014/07/15 04:51:16;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

program to attach two string

1#include <stdio.h>
2 #include <string.h>
3int main()
4 {
5 char a[100],b[100];
6  printf(“Enter the first string\n”);
7          fgets(a);
8           printf(“Enter the second string\n”);
9          fgets(b);
10           strcat(a,b);
11           printf(“String obtained on concatenation is %s\n”,a);
12              return 0;
13 }

Posted in Uncategorized | Leave a comment

file handling

#include<stdio.h>

#include<stdlib.h>

#include<fcntl.h>

int main()

{

int count,fd;

char buf[50];

fd=open(“filem.c”,O_RDONLY,S_IRWXU);

count=read(fd,buf,50);

if(fd<0)

{

perror(“open”);

exit(-1);

}

printf(“the value of count=%d and value of buf=%s”,count,buf);

close(fd);

}

 

note :-       where file : filem.c contain data “she sells sea shell at sea shore”

Posted in Uncategorized | Leave a comment

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: include all header file which are neccessary for driver operation.#include<linux/module.h> 2 #include<linux/fs.h> 3 #include<linux/slab.h> 4 #include<linux/init.h> 5 #include<linux/moduleparam.h> 6 #include<linux/cdev.h> 7 #include<linux/types.h> 8 #include<asm/uaccess.h> 9 #include<linux/jiffies.h> 10 #include<linux/time.h> 11 12 13 14 MODULE_LICENSE(“GPL”); 15 MODULE_AUTHOR(“Satinder.Embdeveloper”); 16 MODULE_DESCRIPTION(“Creating device driver for characters”); 17 18 19 struct scullqset 20 { 21 struct scullqset *next; 22 void **data; 23 }; 24 25 26 27 struct sculldev 28 { 29 struct cdev c_dev; 30 struct scullqset *scullqset; 31 }; ————————–

Posted in Uncategorized | Leave a comment

RCS file: dect.c,v Working file: dect.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: extern dev_t dev; 2 extern int nod; 3 extern unsigned long j,stamp1; 4 extern unsigned long q,stamp2; 5 6 extern struct file_operations fops; 7 extern struct sculldev *sculldev; 8 extern int scull_trim(struct sculldev *); 9 extern struct scullqset * create_scullqset(int); 10 extern int create_qset(int,struct scullqset *); 11 extern int create_quntum(int,struct scullqset *); 12 13 int device_open(struct inode *, struct file *); 14 int device_release(struct inode *, struct file *); 15 ssize_t write(struct file *, const char __user *, size_t, loff_t *); 16 ssize_t read(struct file *, char __user *, size_t, loff_t *); 17 loff_t llseek(struct file *, loff_t, int); —————————- revision 1.1 locked by: root; date: 2014/07/12 12:01:3

Posted in Uncategorized | Leave a comment

RCS file: fops.h,v Working file: fops.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: struct file_operations fops={ 2 open:device_open, 3 release:device_release, 4 write:write, 5 read:read, 6 llseek:llseek 7 }; —————————- revision 1.1 locked by: root; date: 2014/07/12 12:01:39; author: root; state: Exp; Initial revision =============================================================================

Posted in Uncategorized | Leave a comment