Any help?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Info{ //global definition of struct Info
char name[81];
int phone;
char street[81];
char email[81];
}; //no Info struct exists yet
void print(struct Info info){
printf("Name: %s\n", info.name);
printf("Phone Number: %d\n", info.phone);
printf("Street address: %s\n", info.street);
printf("E-mail: %s\n", info.email);
}
int main(void){
int i;
/* declare an instance of the Info struct and assign some values */
struct Info info = {"Buzz Lightyear", 12345, "999 Infinity Way", "[email protected]" };
struct Info *pinfo = &info; //declare a pointer to struct
//and assign it the address of info
printf("\n\n\n\n\n");
print(info); //print via struct members
printf("\n\n"); //print via pointer to struct members
printf("Name: %s\n", pinfo->name);
printf("Phone Number: %d\n", pinfo->phone);
printf("Street address: %s\n", pinfo->street);
printf("E-mail: %s\n", pinfo->email);
printf("\n\n\t\t\t press enter when ready");
i=getchar(); ++i;
return 0;
}