return pointer to struct in C
typedef struct {
char name[20];
int age;
} Info;
Info* GetData() {
Info *info;
info = (Info *) malloc( sizeof(Info) );
scanf("%s", info.name);
scanf("%d", &info.age);
return info;
}
return pointer to struct in C
typedef struct {
char name[20];
int age;
} Info;
Info* GetData() {
Info *info;
info = (Info *) malloc( sizeof(Info) );
scanf("%s", info.name);
scanf("%d", &info.age);
return info;
}
pointer inside structure in c
#include<stdio.h>
struct Student
{
int *ptr; //Stores address of integer Variable
char *name; //Stores address of Character String
}s1;
int main()
{
int roll = 20;
s1.ptr = &roll;
s1.name = "Pritesh";
printf("\nRoll Number of Student : %d",*s1.ptr);
printf("\nName of Student : %s",s1.name);
return(0);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us