Function Declaration In C With Example


Example 1: function in c

#include <stdio.h>  void function(){   printf("I am a function!"); }  int main(void) {      function(); }

Example 2: how to write function in c

#include <stdio.h>  // Here is a function declaraction // It is declared as "int", meaning it returns an integer /* 	Here are the return types you can use:     	char,         double,         float,         int,         void(meaning there is no return type) */ int MyAge() { 	return 25; }  // MAIN FUNCTION int main(void) { 	// CALLING THE FUNCTION WE MADE     MyAge(); }

Example 3: declaration in c

#include<stdio.h> #include<conio.h> void main() { //variable declaration 	int a;   //assinging value to a variable;     a=10; }

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable