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 a struct and its object in C
C Online Editor
Execute Code
More C Sample Codes
#include <stdio.h> #include <string.h> // Define a struct to represent a Person struct Person { char Name[50]; int Age; }; int main() { // Create a Person struct and initialize it struct Person personObj; strcpy(personObj.Name, "John"); //strcpy function to copy the string "John" into personObj.Name personObj.Age = 25; printf("%s is %d years old.\n", personObj.Name, personObj.Age); return 0; }