| | |
please debug the error
![]() |
•
•
Join Date: Aug 2009
Posts: 10
Reputation:
Solved Threads: 0
C Syntax (Toggle Plain Text)
#inclxude<conio.h> #include<stdio.h> #include<stdlib.h> max(int a,int b,int c); void main (void) { clrscr(); int a,b,c,max; long z; printf("input three numbers by giving space"); scanf("%d %d %d",&a,&b,&c); z=max(a,b,c); printf("Max value is %lb",z); getch(); } void max(int a ,int b,int c ) { if(a>b&&a>c) return(a); if(b>c&&b>a) return(b); return(c); }
i make that program to find the maximum value. please help
Last edited by John A; Sep 5th, 2009 at 1:51 am. Reason: added code tags
•
•
Join Date: Aug 2009
Posts: 10
Reputation:
Solved Threads: 0
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
max(int a,int b,int c);
void main ()
{
clrscr();
int a,b,c,max;
long z;
printf("input three numbers by giving space");
scanf("%d %d %d",&a,&b,&c);
max=max(int a, b, c);there it is giving expression syntax
printf("Max value is %d",max);
getch();
}
max(int a ,int b,int c )
{
if(a<b&&a<c)
return(a);
if(b<c&&b<a)
return(b);
return(c);
}
#include<stdio.h>
#include<stdlib.h>
max(int a,int b,int c);
void main ()
{
clrscr();
int a,b,c,max;
long z;
printf("input three numbers by giving space");
scanf("%d %d %d",&a,&b,&c);
max=max(int a, b, c);there it is giving expression syntax
printf("Max value is %d",max);
getch();
}
max(int a ,int b,int c )
{
if(a<b&&a<c)
return(a);
if(b<c&&b<a)
return(b);
return(c);
}
furqankhyraj,
Why don't you go get a read,
1. announcement - How to post your problems?
2. Should I used void main() or int main()?
3. Non-Portable Headers Files - conio.h, graphics.h
4. C - Functions
Use code tag to post source code.
for example,
[code=c]
statements....
[/code]
Why don't you go get a read,
1. announcement - How to post your problems?
2. Should I used void main() or int main()?
3. Non-Portable Headers Files - conio.h, graphics.h
4. C - Functions
Use code tag to post source code.
for example,
[code=c]
statements....
[/code]
Failure is not fatal, but failure to change might be. - John Wooden
Besides all the other "evils" in your code that others have pointed out already, the logic of your max() function in your last post is incorrect. It appears to be returning the minimum value out of the three values passed in to the function.
You should consider yourself lucky that you're even getting people responding to your thread - you have made 10 posts and you still haven't figured out how to use code tags - although that is probably the least of your problems going by the poor quality of your code. You obviously need to study the core basics of C in more detail. And if you have, then you need to study harder.
You should consider yourself lucky that you're even getting people responding to your thread - you have made 10 posts and you still haven't figured out how to use code tags - although that is probably the least of your problems going by the poor quality of your code. You obviously need to study the core basics of C in more detail. And if you have, then you need to study harder.
Manic twiddler of bits
•
•
•
•
#inclxude<conio.h> // shoulld be #include<conio.h> #include<stdio.h> #include<stdlib.h> max(int a,int b,int c); void main (void) { clrscr(); int a,b,c,max; long z; printf("input three numbers by giving space"); // avoid spaces between arguments of scanf scanf("%d %d %d",&a,&b,&c); z=max(a,b,c); printf("Max value is %lb",z); getch(); } // when you are returning values from function need to specify the //return type // here the return type should be int as you are returning integer //value. // int max(int a ,int b,int c ) void max(int a ,int b,int c ) { if(a>b&&a>c) return(a); if(b>c&&b>a) return(b); return(c); }
i make that program to find the maximum value. please help
![]() |
Similar Threads
- Debug Error in facebook app offline access feature (ASP.NET)
- Debug Error Run-Time Check Failure #2 (C++)
- Outlook giving a debug error (Windows Software)
- How to debug error displayed by control in design mode. (ASP.NET)
- Debug error message (Viruses, Spyware and other Nasties)
- JIT debug error (Windows NT / 2000 / XP)
- "Run time error, do you wish to debug?" (Web Browsers)
Other Threads in the C Forum
- Previous Thread: Problem working with POSIX threads
- Next Thread: Helppppppppppppppp!
| Thread Tools | Search this Thread |
#include adobe ansi api array asterisks binarysearch changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic execv feet fgets file fork forloop frequency function getlasterror givemetehcodez global grade graphics gtkgcurlcompiling hacking hardware highest histogram i/o include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue number odf opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf scripting segmentationfault sequential shape socket socketprograming standard string systemcall threads turboc unix user voidmain() wab windows.h windowsapi






