Monday 25 September 2017

Compilation Process c Language



Q : How Compilation, Linking and Loading are related? Also explain the basic task of a Compiler, Linker and Loader?

Solution : 


First of all we need to understand relationship between compilation, linker and linker form following compilation steps.

Compilation Process C Language


Step 1

Sunday 24 September 2017

Sum of series using recursion

Q : Define recursion. Write a complete program to evaluate the given series using recursive function sum( ). Here n is user dependent.
1 + 2 + 3 +…+ n

Solution : 

As we C language is known as building block of functions. This means everything in c language is achieved through a function. In C language there is not any restriction to call a function you can call a function from anywhere No matter of scope.

Friday 22 September 2017

File Open close

Q : How to create a file in C? Why should a user close the file?

Answer : 


For create a file in language,stdio.h header file has fopen method which takes two arguments and return base address of opening file.

Suntax

Return_address  fopen(“file name”,”Open mode”);

Open mode indicate file opening option whether a file is open for read, write, append or both.

Wednesday 20 September 2017

Single link list upto 20 number

Q : Write a program to create a link list. There should be 20 nodes in the list, each node contains an integer between 1-20. The list should be printed at the end.


Solution : 

#include<stdio.h>
typedef struct nlist
{
     int data;
     struct nlist *next;
}node;
node *start=NULL;
node* create(int);
void add(int);