Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing of string to the function

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
write a function that passing string to the function and compared capital string and lower string
 
not sure I understand the question but perhaps this peice of code will help

#include<stdio.h>
#include<string.h>
#include<ctype.h>
void string_upper(char *sentence);

void main()
{
/* initial string of characters */
char fox[] = &quot;the quick brown fox jumps over the lazy brown dog&quot;;
char str[80],*f;
f = fox;
/* function call */
string_upper(f);
puts(fox);
}

/* function to upppercase first letter of each word*/
void string_upper(char *sentence)
{
*sentence = toupper(*sentence);
while(*sentence )
{

if(*sentence == ' ')
{
sentence++;
*sentence = toupper(*sentence);
}
sentence++;
}
}

 
hi, denster thank for your program.....i think it shd be can help me, actually my question is write a function lower_to_upper that takes an alphabetic character and returns its upper case value. It will return the original value if an upper case alphabet is passed in( assume the input parameter is an alphabetic character.

i have a lot of question need to get your advise, if you are free, hope you can teach me coz i just start learning C languages by myself. found that just bought a programming book study quite difficult to understand it.

my question is
1. what is the different bewteen recursion and iteration? (recursion mean that calling itself, right?)
if give you iteration and recursion, which one is preffer?
can u explain to me?
do u have any examples program about recrusion and iteration? i'm not so sure how to different this 2 programs,

2. this question is regarding string.
how we write a function that take three parameters? first two parameters should call string 1 and string 2 and be string, third parameter an integer n. we need to check the first n characters of both strings and return 1 if they are identical, otherwise 0 will be return.


3. Is that has such declaration?
&quot;declare an array of sturcture&quot;
shall i declare like that: struc student_record adcs[40]
**student_record is a structure and adcs is an array name!**

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top