65,211
社区成员
发帖
与我相关
我的任务
分享
int a;//全局作用域
static b;//文件作用域
class A
{
int c;//类作用域
public:
void B()
{
int d;//函数作用域
for(int e = 0; e < 10; e++)//块作用域
}
}
void A()
{
int x;//函数作用域
{
int y;//块作用域
}
}
#include <stdio.h>
using namespace std;
void reverse(char *head,char *rear)
{
while(head < rear)//reverse the sub string
{
char temp = *head;
*head = *rear;
*rear = temp;
head++;
rear--;
}
}
int main()
{
char str[40] = "I am a Student\n You aslo a student";
char *temp,*head,*rear,*start;
start = str;
while(*start)
{
head = rear=temp=start;
while(*rear != '\n' && *rear !='\0')
rear++;
start = rear+1;
rear--;
reverse(head,rear);
while(true)
{
head = temp;
while(*head == ' ')
head++;
if(*head == '\0' || *head == '\n' )
break;
rear = head;
while(*rear != ' ' && *rear != '\n')
rear++;
temp = rear;
rear--;
reverse(head,rear);
}
}
printf("%s\n",str);
return 0;
}