Skip to main content

Posts

To Get All Information of Sarkari Jobs | Results | Admit Card | And courses ,Internships then CLICK HERE

More On Structure Of C Language

  1- Array Of Structure The way we have "array of int's","array of float","array of char" similarly we have "array of structure". Array of structure is nothing but finite number of homogeneous structure variable,belonging to a structure. Contiguous memory is allocated for array of structure. We use array of structure when there is a need of large number of structure variable of same type. Example : #include<stdio.h> #include<conio.h> main() { struct emp       { char name[15];           int age;            float ht;        };      struct emp e[5];          int i=0; for(i=0;i<5;i++) {printf("Enter name,age&height"): scanf("%s %d %f ",&e[i].name,&e[i].age,&e[i].ht); for(i=0;i<5;i++) printf("\n Name=%s,Age=%d,Height=%f",e[i].name,e[i].age,e[i].ht); getch(); } Output : Enter name,age&height Sudarshan 21 5.2 Name= Sudarshan,Age=21,Height=5.2  2-   Copying Structure Variable The wa

Structure In C Language

  Introduction Structure can be defined as,"A finite collection of heterogenous elements". A Keyword "Struct" is used to declare  a structure.

Storage Class Specifier-:

The type of data refer the size of memory for a variable.These variable also has storage class that reffer the life and scope of variable,within program i.e. within block or function. There are four types of Storage Class Specifier -: Automatic Variable Static Variable Register Variable extern variable

Recursion In Function-:

  A function that called itself is known as recursive function and the process of calling function itself is known as Recursion. The default data structure used in recursion is STACK. Recursion works slower than loop. Recursion is more alignment few variable,which make program clean. It is hard to think a logic of recursive function it is also difficult to debug the code containing recursion. img credit:Google Images Example -: #include<stdio.h> #include<conio.h> main() {int num=0 res=0; printf("Enter the number"); scanf("%d".&num); res=fact_N(num); printf("\n Factorial of %d %d",num,res); getch(); } fact_N(intx) {int f=0; if(x==1) return1; else f=x*fact_N(x-1); returnf; }

Difference Between Call By Value And Call By Reference

 Call By Value And Call By Reference:- 1- Call By Value -:  In call by value each of the actual arguement in the calling function is copied to the formal arguement. The change made in the formal arguement have no effect on the values of actual arguement in calling function. 2-   Call By Reference -:  In call by reference the address of actual arguement in the calling function is copied to the formal arguement. The change made in the formal arguement, made change on the values of actual arguement in calling function. img credit: google image Example -: #include<stdio.h> #include<conio.h> main() {int x=0,y=0,res=0; printf("Enter the value of x and y:-"); scanf("%d %d ",&x,&y); printf("\n x=%d,y=%d"x,y); res= swap_value(intx,inty) printf("\n Now x=%d y=%d"x,y); getch(); } int swap_value(intx,inty) {int t=0; printf("\n here x=%d y=%d",x,y); t=x; x=y; y=t; printf("\n now x=%d t=%d y=%d",x,t,y); } Output -: Ente

Nesting Of Function

  C Permit Nesting Of Function Freely,In Nesting Of Function One Function Can Call Another Function, Which In Term Can Call Another Function.There Is No Limit On How Deeply Function Can be Nested. The Order In Which Function Are Define In A Program And Order In Which They Get Called Need Not Necessary Be Same. Img Credit: Google Images Example -: #include<stdio.h> #include<conio.h> main() {printf("\n Hello,This Is Main"); fun1(); printf("\n Hello,We Are Back In Main"); getch(); } fun1(); {printf("\n Hello,This Is fun1");  fun2(); printf("\n Hello, We Are Back In  fun1"); } fun2(); {printf("\n Hello,This Is fun2"); } <?php // Check if the form is submitted if ($_SERVER["REQUEST_METHOD"] == "POST") {     $errors = array();     // Validate First Name (must be at least 3 characters long)     if (isset($_POST['first_name'])) {         $first_name = $_POST['first_name'];         if (strlen($f

Local Variable And Global Variable

 Local Variable And Global Variable The variable declared within the body of the function are called local variable ,such variable can only be used within the body of function,within which they are created. They are created,when the function is called and destroy automatically when the function exit,We may also use the keyword "auto" to declare automatic variable explicitly. One important feature of automatic variable that,there value cannot be change in other functions of same program.This assure that we may declare and use the same variable name in different function in the same program without causing any confusing to the compiler. The variable declared outside of all the function usually before the main() function,are called global variable .Such variable can be used any where in the entire program. Local variable have higher precedence then global variable,If we have two variable of same name,one is local and another is global ,then local variable have higher precedenc

Actual Argument And Formal Argument-:

Actual argument/Actual Parameter are those argument whose value are transferred to the function at the time of its calling and actual argument may be constant,variable or an expression. Formal Argument  /Formal Parameter are those argument which receives the value of actual argument. The data type,order,counting of actual and formal argument should match existingly. img credit: Google images Example -: #include<stdio.h> #include<conio.h> int sum_value(int,int) main() {int a=0,b=0,s=0; printf("Enter The Value Of a And b \n "); scanf("%d %d",&a,&b); s=sum_value(a,b);            /* Actual Argument */ printf("%d sum=%d",s); getch(); } int sum_value(int a,int b)    /* Formal Argument * / {s=0;   s=a+b;   return s; } Output -: Enter The Value Of a And b 10 5 sum=15

Introduction To Functions:-

A Function is a separate module,sub-program procedure which is usually written after the main function and is capable of performing a small complete independent job. Function serve two purposes-: They allow a programmer to say ," This piece of code does a specific job which stand by itself and should not be mixed up with anything else. They make a block of code reuse-able , since a function can be reused in different context ,without repeating parts of the program text. In C,there are two types of function-: Pre-defined/ Library Function -: They are the parts of the C Language,means they are present in any of the various headers,that can be included in the program. Examples -: The function sqrt() and pow() are present in <math.h>                           The function getch() and clrscr() are present in <conio.h> User-define Function -: The function which are created by the user to accomplish a particular task is known as user-define function. Some Important things wh

Row Major Order And Column Major Order in Array-:

The Formula to calculate the address of an element in 2-d array using Row Major Order would be-: Arr( A[i][j])=BA+[i*n+j]*w where, BA-: Base Address w-: width [ data type of array] i-: subscript of array element j-: subscript of array element n-: number of column m-: number of rows Q- Find address of element in array having location a[2][3] with base address 100 and it is an integer type array,and the size of array is a[3][4]? =>   we know that,                 Arr( A[i][j])=BA+[i*n+j]*w       here,                a[2][3]=100+[2*4+3]*2                a[2][3]=100+[8+3]*2                a[2][3]=100+22                a[2][3]=122.  The Formula to calculate the address of an element in 2-d array using  Column Major Order  would be-: Arr( A[i][j])=BA+[j*n+i]*w where, BA-: Base Address w-: width [ data type of array] i-: subscript of array element j-: subscript of array element n-: number of column m-: number of rows     Q- Find address of el

Searching In Array-:

Searching means to find whether a particular value is present in the array or not. If the value is present in array then the search is said to be successful and the search process gives the location of that value in array,otherwise,if the value is not present in the array the search process displays the appropriate message and in this case search is said to be unsuccessful. There are two popular methods for searching the array elements-:               1- Linear Search CLICK HERE               2- Binary Search CLICK HERE Watch The Videos Below ads <!DOCTYPE html> <html> <head>     <title>User Login</title> </head> <body>     <h1>User Login</h1>     <form method="post" action="login_process.php">         <label for="email">Email:</label>         <input type="email" name="email" required>         <br>         <label for=&qu

Sorting Array Element-:

Sorting means arranging element in some specific order. If the array element are integer or float type values then they are sorted to either in ascending order or descending order. But if the array element are of char type then they are sorted in alphabetical order or reverse order. The possible types of sorting to solve an array of integer type are as follow-:               1- Selection Sorting CLICK HERE               2- Bubble Sorting  CLICK HERE               3- Insertion Sorting  CLICK HERE                                     ads           Watch The Video Below                         <?php // Start the session (if not already started) session_start(); // Check if the user is logged in, if not redirect to the login page if (!isset($_SESSION['username'])) {     header("Location: login.html");     exit(); } // Replace the following with your actual database credentials $servername = "localhost"; $username = "your

Program Of Insertion Sort-:

#include<stdio.h> void InsertionSort( int a[],  int n) {      int j, p;      int tmp;      for (p = 1; p < n; p++)      {          tmp = a[p];          for (j = p; j > 0 && a[j-1] > tmp; j--)              a[j] = a[j-1];          a[j] = tmp;      } } int main() {      int i, n, a[10];      printf ( "Enter the number of elements :: " );      scanf ( "%d" ,&n);      printf ( "Enter the elements :: " );      for (i = 0; i < n; i++)      {          scanf ( "%d" ,&a[i]);      }      InsertionSort(a,n);      printf ( "The sorted elements are ::  " );      for (i = 0; i < n; i++)          printf ( "%d  " ,a[i]);      printf ( "\n" );      return 0; } Output-: Enter the number of elements :: 7 Enter the elements :: 10 30 80 20 60 40 50 The sorted elements are :: 10 20 30 40 50 60 80 Watch The Video Below

Download The Book "Let Us C" By Yashavant P.Kanetkar,Click The Below Button

-->Email Subscription

Enter Your Email Address:-

Delivered by FeedBurner

Copyright © 2020 TechProgramiz|All Right Reserved|Made By-: Sudarshan Pandey