Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: How is memory allocated

Reply
Thread Tools

Re: How is memory allocated

 
 
Martin Ambuhl
Guest
Posts: n/a
 
      06-27-2003
(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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to check memory size allocated to JVM? Laura Heinzmann Java 1 02-16-2005 04:37 AM
Dynamically Allocated Memory vs. Statically allocated Memory csnerd@gmail.com C++ 5 12-09-2004 01:44 AM
How do I know if memory is already allocated? Kjell Arne Johansen C++ 8 09-02-2003 06:12 AM
Duplicate memory allocated by IndexedTriangleArray Duncan Java 0 07-21-2003 07:25 PM



Advertisments