#include<stdio.h> void swap(int *,int *); int main() { int temp; int *t; int a=100,b=200; //Using 3 variables //1.1 temp = a; a = b; b = temp; printf(“%d %d\n”,a,b); //1.2 swap(&a,&b); printf(“%d %d\n”,a,b); //Using 2 variables //2.1 a += b; … Continue reading
#include<stdio.h> int main() { printf(“Hello World”); return 0; } /* Errors Line 1 :- *1. If u remove only preprocessor (#)->error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token *2.#nclude<stdio.h> -> error: invalid preprocessing directive #nclude *3. #include … Continue reading
A character device driver is one that transfers data directly to and from a user process. This is the most common type of device driver and there are plenty of simple examples in the source tree. Character device drivers may … Continue reading
CD – Change Directory Command ============================= – cd means change working directory – Prototype: cd [-L | -P] [directory] cd – -If you do not give any directory to cd command, it will take you to home directory. eg. cd … Continue reading
Common Linux Virtual Directories ================================= Directory Usage / Root of virtual directory. No files are placed here (normally) /bin … Continue reading
Linux Filesystem ================ – In windows, physical drive determines the pathname of the file. – Windows assigns a letter to each disk drive. – Each directory contains its own directory structure for accesing files stored in it. – For eg. … Continue reading
To get help in fedora ===================== To learn about any new command, function or utility in Fedora we can get help from it. It has 3 such commands :- i) man pages – These are manual pages . – It … Continue reading
To change default prompt :- ======================== – We can change default prompt by assigning the character to it. – Each character have a specific meaning. BASH Shell Prompt Characters :- Character Description \a Bell Character \d Date in format “Day … Continue reading
Command line Prompt =================== Environmental variables that controls Command line Prompt PS1 : Controls the format of default command line prompt. PS2 : Controls the format of second-tier command line prompt. PS3 : Controls the format of tertiary command line … Continue reading
Linux Run Levels ================ Run Level Description 0 Halt 1 Single-User mode 2 Multi-user mode, usually … Continue reading
The boot process of linux ========================= – After you turn on your Linux System, linux kernel loads into memory and runs. – Firstly, it runs the init process. – init program is usually located at /sbin/init. – init process has … Continue reading
Sockets ======= A socket is a communication mechanism that allows client/server systems to be developed either locally,on a single machine, or across networks. – It is a communication mechanism – It allows client/server systems to developed either locally or across … Continue reading
Prototype : – #include <stdio.h> char *fgets(char *s, int size, FILE *stream); Defination :- fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an … Continue reading
#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