NEWS: Total Picture Views: 155282 | Total Article Views: 165607 | Top 5 Most Popular Article: 1. Am I Stuck Algorithm with Becker Robot | 2. PickUpThings with Becker Robot | 3. How to read a JSON and work with it | 4. Encrypted Data GUI (Download .Zip) | 5. Create Wall and Things with Becker

Structure C


In this example I will be showing how to create and print a structure


#ifdef _MSC_VER
#include <stdio.h>
#include <string.h>

typedef struct Customer
	char name[20];
	char phone[12];
	int age[3];

int main(int argc, char *argv[])
	struct Customer c[2];
	char str1[20];
	char str2[12];
	int str3[3];
	for (int i = 0; i < 2; i++){
		printf("Entrer Name Phone Age\n");
		scanf("%s %s %i", &str1, &str2, &str3);
		strcpy(c[i].name, str1);
		strcpy(c[i].phone, str2);
		strcpy(c[i].age, str3);

	for (int i = 0; i < 2; i++){
		printf("%s \n %s \n %i \n \n",c[i].name,c[i].phone,c[i].age);
	return 0;
Attachments: None

Tags: strcpy scanf printf structure define array

Total Views: 747

My name is Jean-Mathieu

I created this website so other people could enjoy finding useful stuff easier. If you have any question do not hesitate to contact me.

jean8mathieuCreated on 01/20/15 and updated on 01/20/15


Disclosure: We are a website that needs compensation to operate like any other website on the internet.
We may receive consideration for our reviews but we are totally unbiased and do not accept paid reviews or fake reviews claiming to be something they are not.