Q:

C - User define function example with arguments and no return type

0

C - User define function example with arguments and no return type

Define a function with arguments and no return type in C language.

Here, we are function fun1 which has two arguments int and char*, while calling the function, we are passing two values, integer value and character array.

Consider the program, how can we declare and define a function that can use integer and character pointer arguments.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program

/*  
C - User define function example with arguments 
and no return type
*/

#include <stdio.h>

// function with void return type
void * fun1(int sum , char *str)
{
  printf("\nThe value of sum is : %d",sum);
  
  printf("\nThe string is : "); 
  puts(str);
}

// main function
int main()
{
  int a=10;
  char buffer[30]="includehelp.com";
  
  //Calling function 
  fun1(a,buffer);
  
  return 0;
}

Output

    The value of sum is : 10
    The string is : includehelp.com

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C program to pass a one dimensional (1D) array to ... >>
<< C - User define function example with no argument ...