#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 10 int main(int argc, char* argv[]) { int count=0; int i; char temp[64]="192.168.1."; char arr[4]; char szIP[MAX][32]; for(i=0;i<MAX;i++) { memset(arr,0,4); strcpy(temp,"192.168.1."); itoa(i+99,arr,10); strcat(temp,arr); strcpy(szIP[i],temp); } i=i-1; while(i>=0) { printf("%s\n",szIP[i]); i--; } scanf("%*d"); return 0; }
转载于:https://www.cnblogs.com/qiangua/archive/2013/04/12/3016858.html