String Reference

String Reference - printf("%s %s is your...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//This program demonstrates string parameter passing #include <stdio.h> void load(char*first,char*last) /* in parameter list: char means only 1 character char* means string in function leave off * */ { printf("Enter your First name "); gets(first); printf("Enter your last name "); gets(last); } void main() { char f[20],l[25]; load(f,l);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: printf(&quot;%s %s is your name\n&quot;,f,l); } /* Main first prototype void load(char*,char*); void main() { char f[20],l[25]; load(f,l); //no &amp; on strings printf(&quot;%s %s is your name\n&quot;,f,l); } void load(char*first,char*last) { printf(&quot;Enter your First name &quot;); gets(first); printf(&quot;Enter your last name &quot;); gets(last); } */...
View Full Document

Ask a homework question - tutors are online