100% pointer & structure
#include<stdio.h>
void callstruct(int *ptrstruct)
{
printf("\n just entered the function callstruct");
printf("\n\n roll =%d",*ptrstruct++);
printf("\n name=%c",*ptrstruct);
}
void main()
{
struct student
{
int r_no;
char name; // assuming name is single letter like a or b or Z
}s;
printf("\n enter the roll no, name:");
scanf("%d %c",&s.r_no,&s.name);
printf("\n roll no= %d, name=%c",s.r_no,s.name);
printf("\n\n %u %u %u",&s, &s.r_no,&s.name);
printf("\n we r about to enter the function callstruct\n");
callstruct(&s);
}
void callstruct(int *ptrstruct)
{
printf("\n just entered the function callstruct");
printf("\n\n roll =%d",*ptrstruct++);
printf("\n name=%c",*ptrstruct);
}
void main()
{
struct student
{
int r_no;
char name; // assuming name is single letter like a or b or Z
}s;
printf("\n enter the roll no, name:");
scanf("%d %c",&s.r_no,&s.name);
printf("\n roll no= %d, name=%c",s.r_no,s.name);
printf("\n\n %u %u %u",&s, &s.r_no,&s.name);
printf("\n we r about to enter the function callstruct\n");
callstruct(&s);
}
ఆన్లైన్ లో చేస్తే తెరమీద
enter the roll no, name:2 a
roll no= 2, name=a
2006898232 2006898232 2006898236
we r about to enter the function callstruct
just entered the function callstruct
roll =2
name=a
roll no= 2, name=a
2006898232 2006898232 2006898236
we r about to enter the function callstruct
just entered the function callstruct
roll =2
name=a
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.