EmbLogic's Blog

Category Archives: Data Structures with C

what is the compilation process in c program.

Compilation process in C program There are four phases for a c program to be execute, 1.pre-processor 2.compiler 3.assembler 4.linker let’s start with the first one, #Pre-Processor- The pre-processor removes the comments and include header files in source code, replace … Continue reading

Posted in Data Structures with C | Leave a comment

Basic of c language

Introduction to C:- C is a general purpose high level programming language used to develop portable applications and firmware. It is originally designed to develop system software and operating systems. C was invented by Dennis’s Ritchie at bell labs in … Continue reading

Posted in Data Structures with C | Leave a comment

gcc compilation process

  Gcc compiler Compilation Process: Any c file, a user wants to compile is not directly compiled. For example, there is c file having a name hello.c, this hello.c file is not directly provided to the compiler. Hello.c file first … Continue reading

Posted in Data Structures with C | Leave a comment

Compiler process in ‘C’

Compiler is a software ,which is use for converting the code language to machine language. the c programe are work in 5 process- Preprocessor compiler assembler linker loader Preprocessor-In the preprocessor a preprocessor directive (#) and a header file (stdio.h) … Continue reading

Posted in Data Structures with C | Leave a comment

What is Function Pointer

A function pointer (or subroutine pointer or procedure pointer) is a type of pointer supported by third-generation programming languages (such as PL/I, COBOL, Fortran,[1] dBASE dBL, and C) and object-oriented programming languages (such as C++ and D).[2] Instead of referring … Continue reading

Posted in Data Structures with C | Leave a comment

Different methods of swapping 2 numbers

#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

Posted in Data Structures with C | Tagged , , , , | Leave a comment

Errors in “Hello World” program

#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

Posted in Data Structures with C | Tagged , , , , , , | Leave a comment

What is bss (Block Storage Start) ?

The .bss segment stores all uninitialized global, static, and external variables (declared with extern keyword). Global, external, and static variable are by default initialized to zero. This section occupies no actual space in the object file. it is merely a … Continue reading

Posted in Data Structures with C | Leave a comment

Matrix Addition using 2D Array with Pointers

#include #include int main() { int r,c,k; printf(“enter the size of rows\n”); scanf(“%d”,&r); printf(“enter the size of columns\n”); scanf(“%d”,&c); int **a,**b,**d,i,j; a=(int **)malloc(sizeof(int*)*3); if(!a) { perror(“malloc”); goto x; } for(i=0;i<3;i++) *(a+i)=(int *)malloc(sizeof(int)*3); if(!(*(a+i))) { perror("malloc"); goto x; } b=(int **)malloc(sizeof(int*)*3); … Continue reading

Posted in Data Structures with C | Leave a comment

dangling and wild pointer

dandling pointer is a pointer which pointing to non existing memory location. when a object is deleted or de allocated without modifying the value of the pointer that time dangling pointer arise. uninitialized pointer are known as wild pointer beacause … Continue reading

Posted in Data Structures with C | Leave a comment

Write a Program to Subtract two matrix?

code : #include<stdio.h> #include<stdlib.h> int main() { system(“clear”); int r,c,i,j,a[10][10],b[10][10],d[10][10]; printf(“Enter Row\n”); scanf(“%d”,&r); printf(“Enter Column\n”); scanf(“%d”,&c); printf(“Enter Element of Matrix1\n”); for(i=0;i<r;i++) { for(j=0;j<c;j++) { scanf(“%d”,&a[i][j]); } } printf(“Enter Element of Matrix2\n”); for(i=0;i<r;i++) { for(j=0;j<c;j++) { scanf(“%d”,&b[i][j]); } } for(i=0;i<r;i++) { … Continue reading

Posted in Data Structures with C | Leave a comment

Multiple Data Compression Technique

Multiple Data Compression is an iterative technique to compress the text data. RCS file: ./header.h,v Working file: ./header.h head: 1.4 branch: locks: strict root: 1.4 access list: symbolic names: keyword substitution: kv total revisions: 4; selected revisions: 4 description: This … Continue reading

Posted in Data Structures with C, Project 2: Multiple Data Compression and Encryption | Leave a comment

Write a program to find particular no. is power of two or not?

CODE: #include<stdio.h> int main() { int n; printf(“Enter a value\n”); scanf(“%d”,&n); if((n &(n-1))==0) printf(“no. is power of 2\n”); else printf(“no. is not power of 2\n”); return 0; }

Posted in Data Structures with C | Leave a comment

Write a program to reverse a number?

CODE: #include<stdio.h> int main() { int n,r=0,num; printf(“Enter a number:\n”); scanf(“%d”,&n); num=n; while(n!=0) { r=r*10; r=r+n%10; n=n/10; } printf(“Reverse number is %d\n”,r); if(num==r) printf(“Palindrome number\n”); else printf(“Not a Palindrome\n”); return 0; }

Posted in Data Structures with C | Leave a comment

Write a program to print Diamond Pattern?

CODE: #include<stdio.h> int main() { int i,j,k,n,space,temp; printf(“enter value of n\n”); scanf(“%d”,&n); temp=n; for(i=1;i<=n;i++) { for(j=i;j<n;j++) { printf(” “); } for(k=1;k<(2*i);k++) { printf(“*”); } printf(“\n”); } temp=1; for(i=n-1;i>=1;i–) { for(j=1;j<=temp;j++) { printf(” “); } temp++; for(k=1;k<(i*2);k++) { printf(“*”); } printf(“\n”); … Continue reading

Posted in Data Structures with C | Leave a comment