xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create and call a function with parameter in C
C Online Editor
Execute Code
More C Sample Codes
#include <stdio.h> #include <string.h> // Function declarations char* MethodReturnString(const char* message); int MethodReturnInteger(int x, int y); int main() { // Example 1 function called const char* returnStringValue = MethodReturnString("Hello from parameter"); printf("%s\n", returnStringValue); // Example 2 function called int returnIntegerValue = MethodReturnInteger(10, 20); printf("This method returns the sum of parameter values: %d\n", returnIntegerValue); return 0; } // Example 1: char* MethodReturnString(const char* message) { // Allocate memory for the returned string char* result = (char*)malloc(strlen(message) + 1); strcpy(result, message); return result; } // Example 2: int MethodReturnInteger(int x, int y) { return x + y; }