(Samuel Thomas) wrote (27 Jun 2003) in
news: om / comp.lang.c:
> Hello Everybody,
>
> Could you please go through the code I wrote and help me with my
> doubts?
Please compare your code (on the left) to a slightly modified
version on the right. And there is no such thing as pass-by-reference in
C.
#include <stdio.h> #include <stdio.h>
#include <conio.h> <
void printnamefirst(char[]); | void printnamefirst(void);
void printnamesec(char[]); void printnamesec(char[]);
void main() | int main()
{ {
clrscr(); | printnamefirst();
printnamefirst(name); | return 0;
} }
void printnamefirst(char nm[]) | void printnamefirst(void)
{ {
char nam[20] ="Samuej Thomas"; char nam[20] = "Samuej Thomas";
printnamesec(nam); printnamesec(nam);
printf("%s \n",nam); printf("%s \n", nam);
} }
void printnamesec(char ns[]) void printnamesec(char ns[])
{ {
printf("%s \n",ns); printf("%s \n", ns);
ns[5]='l'; ns[5] = 'l';
} }
--
Martin Ambuhl
Returning soon to the
Fourth Largest City in America