segmentation fault
- From: sid <kingsiddharth@xxxxxxxxx>
- Date: Sat, 30 Jun 2007 08:30:37 -0700
Hi!
I am using gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5) on an Ubuntu 6.06
64bit version on an AMD 64bit machine. Each time I compile and execute
the following program I get segmentation fault. Please tell me whether
the code I have written has some errors or whether there is problem
with my OS or the compiler.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc,char *argv[])
{
int c;
if(argc == 0)
printf("\nNo Arguments\n");
else if(strcmp(argv[argc],"lower") == 0)
{
while((c = getchar()) != EOF)
putchar(tolower(c));
}
else
{
while((c = getchar()) != EOF)
putchar(toupper(c));
}
return 0;
}
.
- Follow-Ups:
- Re: segmentation fault
- From: CBFalconer
- Re: segmentation fault
- From: Malcolm McLean
- Re: segmentation fault
- From: Harald van Dijk
- Re: segmentation fault
- From: Army1987
- Re: segmentation fault
- Prev by Date: Re: Machine epsilon: conclusion
- Next by Date: Re: Display C in HTML
- Previous by thread: Machine epsilon: conclusion
- Next by thread: Re: segmentation fault
- Index(es):
Relevant Pages
|