|
-
Oct 16th, 2002, 02:34 AM
#1
Thread Starter
New Member
how to return a string in function?
I have try this for 10 time but it can't work and I'am sure my logic is correct, is this coding correct::
#include<stdio.h>
#include<conio.h>
//======================================
char* Decodestr(char* encodedstr,char* codestr);
//======================================
void main(){
char encodedstr[6]=" ";
char codestr[6]=" ";
clrscr();
printf("Enter String:");
scanf(" %s",&encodedstr);
printf("Enter Code:");
scanf(" %s",&codestr);
Decodestr(encodedstr,codestr);
printf("Encoded Result Is:%s");
getch();
}
//========================================
char* Decodestr(char* encodedstr,char* codestr){
char *p1, *p2;
p1=encodedstr;
p2=codestr;
char ans[6]=" "
while(*p1!='\0'){
ans[c]=*p1 + *p2;
p1++;
p2++;
c++;
}
return;
}
//======================================
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|