Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Segment Violation

Name: fsdf 2011-03-14 20:32

I cant find the last segment violation, I think its in line 26 but I dont know what it should be.

#include "stdio.h"
#include "string.h"

// function prototypes
void strrvr( char outstr[] , char instr[] );

// driver
int main()
{
char outstr[100];
char instr[100]="emordnilap";
strrvr(outstr, instr);
printf( "%s\n", outstr );
return( 0 );
}

// strrvr function
void strrvr(char strout[], char strin[])
{
int i;
int n = strlen( strin );
strout[i] = strout[n]; // copy the null string terminator
for (i = 0 ; i < n ; i-- )
strout[n-i-1] = strin[n];
}

Name: Anonymous 2011-03-14 23:05

>>16

You shouldn't be using C++ comments

C++ users use C++ comments

This behavior is unscientific and ultimately destructive.

Name: Anonymous 2011-03-14 23:24

>>24
Shut the fuck up. /**/ is a stupid syntax.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List