hello guys, need some help here its been a long time i've touch this and im revising my work now, so need some help as i have something that im not too sure of....so here it is
#include <stdio.h>
void getname (char n[20]);
main()
{
char name[20];
getname(name);
printf("your name is %s\n", name);
return(0);
}
void getname (char n[20])
{
printf("pls enter name: ");
gets(n);
return; // <====== need to return?
}
this is an example from a book, so i was wondering if this book is wrong...
would i need to return the variable "n" back to main, in order for main function to printf it?
#include <stdio.h>
void getname (char n[20]);
main()
{
char name[20];
getname(name);
printf("your name is %s\n", name);
return(0);
}
void getname (char n[20])
{
printf("pls enter name: ");
gets(n);
return; // <====== need to return?
}
this is an example from a book, so i was wondering if this book is wrong...
would i need to return the variable "n" back to main, in order for main function to printf it?