Wednesday 15 July 2020

Difference between Union & Structure


SN.
Structure
Union
1
Struct keyword is used to make structure variable
Union  keyword is used to make structure variable
2
Structure is user defined data type which is used frequently to represent real word data type presentation.
Union is also a user defined data type which is used to achieve specific need.
3
Structure allocates memory for its all member.
Union allocates memory only for the biggest data member.
4
All member data can be hold at same time in a structure variable.
Only one data from member can be hold at a time.
5
Several members can be initialized at ones.
Only first member can be initialized.


Tuesday 14 July 2020

File writing program append mode using Command Line Argument

Q : Write a program using command line parameters to append one text file to another text file.?


Answer : 



#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main(int argc,char *argv[])
{
     FILE *infile,*outfi

Monday 13 July 2020

Bitwise Operator Complete solution

Bitwise operators are used to perform bit operations. Decimal values are converted into binary values which are the sequence of bits and bit wise operators work on these bits. Bit wise operators in C language are given below.

1. & (bitwise AND)
2. | (bitwise OR) 
3. ~ (bitwise NOT)
4. ^ (XOR)
5. << (left shift) 
6. >> (right shift).

Link List Disadvantage


  • If fix element is required for an operation then link list is not a good option because it’s consumed more memory to manage the dynamic address for the list.
  • Random traversal is not possible in link list due to dynamic memory allocation which is unpredictable and scarred in memory.
  • Reverse traversing is not possible in a single link list because only the next pointer is used to point next element.
  • Manual delete is required because link list uses memory in heap section.
  • Infinite traversal occurred in a circular list if not handled properly.
  • More Time and memory required compare to array.