problem in C ( structures )

Status
Not open for further replies.

frogonfloor

Broken In
#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

God of Mistakes...
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

Journeyman
#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);
}
 
Status
Not open for further replies.
Top Bottom