小编Ami*_*rma的帖子

字符串反向程序抛出异常

// ExampleCodes.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<stdio.h>
#include<iostream>
using namespace std;    

char* stringReverse(char* s)    
{    

    char temp, *p,*q;    
    q = s;    
    while( *(++q));    
    for( p = s; p &lt; --q; p++)    
    {    
        temp = *p;    
        *p = *q;     
        *q = temp;    
    }    
    return s;    
}    


int _tmain(int argc, _TCHAR* argv[])    
{    

    stringReverse("StringReverse");    
    return 0;    
}    
Run Code Online (Sandbox Code Playgroud)

c++

2
推荐指数
2
解决办法
520
查看次数

标签 统计

c++ ×1