DIGIT-ARC read-only archive · snapshot: July 23, 2026

problem in C ( structures )

5 posts · originally from https://geek.digit.in/community/threads/problem-in-c-structures.84170/

F
frogonfloor Original post #1
Apr 2, 2008 at 7:13 AM
#include<conio.h>
#include<stdio.h>
struct name
{
char n[20];
};
function (int *n)
struct name *n
{
printf("%c",*n->n);
}
void main ()
{
struct name n
scanf("%c",&name.n);
function(&n);
}

this is a simple program in which i have to take user name then print it using pointer , function and structure .

hi friends i am trying to run this program but it is giving error in line 8 declaration syntax error . please some on correct it .
thanks in advance .
Garbage
Garbage #3
Apr 2, 2008 at 9:23 AM
I think, the problem is here..
function (int *n)
struct name *n

Which type of declaration u following ?? Do u want to do as..
Code:
function (*n)
struct name *n
{
// ur code
}
Tushar.bar
Apr 2, 2008 at 8:19 PM
#include<conio.h>
#include<stdio.h>
struct name
{
char n[20];
};
void function(struct name *n)
{
printf("%s",n->n);
}
void main ()
{
struct name n;
scanf("%s",&n.n);
function(&n);
}