top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a function which returns an integer without using return keyword in c?

+1 vote
531 views
Write a function which returns an integer without using return keyword in c?
posted Mar 17, 2016 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+2 votes

This problem can be solved using call by reference method, see the following sample function -

void returnvaluewithoutreturnkeyword(int *a)
{
  *a=5;
}
answer Mar 17, 2016 by Rajan Paswan
+1 vote

simple just send address

#include <stdio.h>

void initialize(int *nmb)                 /* here you are entering variable in main trouth pointer */
{
  *nmb = 5;                                        /* if we print variable number in main its 5*/    
}

int main()
{
  int number;

  initialize(&number);                     /* here you are sending address of variable number */
  printf("----%d----",number);    
  return 0;
}
answer Apr 18, 2017 by Leon Martinović
...