Welcome to W3Courses
 Like Us on Facebook

C

Source Code for Writing to and Reading from a File in C Programming

Following is the three different type of source code for writing to and reading from a file using C programming

1)
#include <stdio.h>
int main()
{
   char c;
   FILE *fpntr;
   fpntr = fopen("textFile","r");
   while(fscanf(fpntr,"%c", &c)==1)
        putchar(c);
   fclose(fpntr);
}

Share

Source Code for Checking if Three Numbers are the Sides of a Right Triangle in C programming

Following is the source code for checking if three numbers are the sides of a right triangle using C programming.

Share

Source Code for Binary Recursive Search in C Programming

Following is the source code for binary recursive search:

#include <stdio.h>
#define N 20

Share

Source Code for Linear Recursive Search in C Programming

Following is the source code for Linear Recursive Search:

#include <stdio.h>
#define N 20

Share

Source Code to Create Simple Linked List in C Programming

Following is the source code to create a simple linked list:

struct node_struct
{  int data;
   struct node_struct *next;
}*list,*curr;

Share

Source Code to Create Linked List Kernel (car, cdr, cons, empty list, printlist, readlist etc.) in C Programming

Following is the source code to create a Linked List Kernel (car, cdr, cons, empty list, printlist, readlist etc.)

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int checking = 0;                   
typedef int boolean;
typedef char data;

Share

PrintList Shorter Last Element Source Code for Linked List Functions and Procedures in C Programming

Following is the Source Code to Create Linked List Functions and Procedures (PrintList, Read Element, Read List, Shorter, Last Element)

Share

Delete All Delete First Delete Last Source Code for Linked List Functions and Procedures in C programming

Following is the Source Code to Create Linked List Functions and Procedures (Delete All, Delete First, Delete Last)

(1)
list del_all (list L, data alpha)
{
 if (null(L))
  return nullist();
 else if (car(L) = = alpha)
  return del_all(cdr(L), alpha);
 else
  return cons(car(L), del_all(cdr(L), alpha));
}

Share

Copy Rotate Delete Last Element Subtract Source Code for Linked List Functions and Procedures in C Programming

Following is the Source Code to Create Linked List Functions and Procedures (Copy, Rotate, Delete Last Element and Subtract)

(1)
list copy (list L)
{
 list J;
 if (null(L))
  J = nullist();
 else
  J = cons(car(L), copy (cdr(L)));
 return  J;
}

Share

Return Last Element Second From Last Delete N Source Code for Linked List Functions and Procedures in C Programming

Following is the Source Code to Create Linked List Functions and Procedures (Return Last Element, Second From Last, Delete N)

Share