Sunday, 5 July 2020

Change/return more than value from function | C Language

Q : Write down three different methods used for referencing multiple values from a function.


Answer : you can return only one value from function using return statement but you can change multiple values from a function using a pointer, array, and structure. The following program will show you a demo. 




#include<stdio.h>
#include<conio.h>
#include "mylib.h"
/*============================
     Girfa Student Help
     Multiple value set from function
==============================*/
struct data
{
     int roll;
     int marks;
};

Create your own header file | C language

create  a blank file and  add following code

int sum(int a, int b)
{
     return(a + b);
}

save this file named with myheader.h

create  a new file and call your function  as given below

#include<stdio.h>

#include<conio.h>

#include "mylib.h"

/*============================

     Girfa Student Help

     Substring wihout using library function

==============================*/

void main()

{

  clrscr();

  printf("\n\t%d",sum(1,2));

  getch();

}


Tuesday, 30 June 2020

Substring program without library function | C Language

Q : Write a ‘C’ Program to find substring of string without using Library Function.

Answer :

#include<stdio.h>
#include<conio.h>
#define MAX 50
/*============================
     Girfa Student Help
     Substring wihout using library function
==============================*/

Sunday, 28 June 2020

Sum of lower triangular program | C language

Q : Write a ‘C’ Program to find Sum of lower triangular elements in a matrix.


Answer : 


Lower triangular


Lower triangular matrix is a special square matrix whole all elements above the main diagonal is zero.