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
How to declare variable in C
C Online Editor
Execute Code
More C Sample Codes
#include <stdio.h> int main() { //In C, the data type of a variable needs to be specified explicitly //Declare the varibable and assign value later int integerVar; //Declare an integer variable integerVar = 42; //Assignment of a value to the variable //Assign value at the time of declaring variable char charVar = 'A'; //Declare and initialize a character variable char charArray[] = "Hello from C world!"; // A character array (string) // Floating-point data types float floatVar = 3.14; //Declare and initialize a float variable double doubleVar = 3.14159265359; //Declare and initialize a double variable // Output the values of the variables printf("Integer: %d\n", integerVar); // \n is the newline in c printf("Char: %c\n", charVar); printf("String: %s\n", charArray); printf("Float: %f\n", floatVar); printf("Double: %lf\n", doubleVar); return 0; }