⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test8_5.txt

📁 Linux下的C语言编程
💻 TXT
字号:
#include <stdio.h>
#include <string.h>

void upcase(char *inputstring, char *newstring);

int main(void)
{
    	char *string;
    
    	upcase("Hello",string);
    	printf("str1=%s \n", string);
	capitao("Goodbye", string);
    	printf("str2=%s\n", string);

    	free(string);

    	return 0;
}


void upcase(char *inputstring, char *newstring)
{
    	int counter;

    	if(!newstring)
    	{
        	if(!(newstring=realloc(NULL, strlen(inputstring)+1)))
		{
        		printf("ERROR ALLOCATING MEMORY! \n");
        		exit(255);
		}
    	}
    	else
    	{
        	if(!(newstring=realloc(newstring, sizeof(inputstring)+1)))
        	{
        		printf("ERROR REALLOCATING MEMORY! \n");
        		exit(255);
    		}
	}
        strcpy(newstring, inputstring);
	for(counter=0; counter<strlen(newstring); counter++)
	{
        	if(newstring[counter]>=97&&newstring[counter]<=122)
             		newstring[counter]-=32;
	}
	return ;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -